# How to avoid freezing a rubygnome GUI?

**URL:** <https://www.ruby-forum.com/t/how-to-avoid-freezing-a-rubygnome-gui/241906>\
**Category:** Ruby-Gnome 2\
**Created:** [May 10, 2015, 7:23pm UTC](https://www.ruby-forum.com/t/how-to-avoid-freezing-a-rubygnome-gui/241906 "2015-05-10T19:23:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Detlef\_R](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/58f4c7/32.png) [@Detlef\_R](https://www.ruby-forum.com/u/Detlef_R)\
**Post date:** [May 10, 2015, 7:23pm UTC](https://www.ruby-forum.com/t/how-to-avoid-freezing-a-rubygnome-gui/241906/1 "2015-05-10T19:23:41Z")

</div>

Hi guys,

Here is my problem.

I have a GUI widget, in ruby-gnome, and I have buttons.

Each button plays a video file.

I use system() for this, and mplayer.

When I click the button, all works well, mplayer plays the  
video.

The problem is that, while mplayer plays this file, the  
rubygnome GUI “freezes”, until that mplayer window is  
closed again.

Is there a way to somehow allow the background GUI frame  
to not freeze? On the commandline I can play multiple  
videos, from different KDE konsole tabs, so I wonder that  
must be possible in a GUI too, perhaps via a thread or  
something.

Thank you.

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [May 11, 2015, 6:18pm UTC](https://www.ruby-forum.com/t/how-to-avoid-freezing-a-rubygnome-gui/241906/2 "2015-05-11T18:18:37Z")

</div>

On an ancient version of ruby-gnome, I used this to do something  
similar:

def threaded()  
if(block\_given?)  
@\_w\_events = @window.events  
@window.events = 0  
@window.sensitive = false  
@window.window.cursor=Gdk::Cursor.new(Gdk::Cursor::WATCH)

```
  Thread.new do
    begin
      yield
    rescue
      #error($!)
    end

    @window.window.cursor = nil
    @window.events = @_w_events
    @window.sensitive = true
  end
end

```

end

And then wrap whatever I needed to run like this.

threaded() do  
play\_video()  
end

You might need to make a few modifications though, because it was on an  
ancient version of ruby-gnome, and on Ruby 1.8.6.

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [May 12, 2015, 12:30pm UTC](https://www.ruby-forum.com/t/how-to-avoid-freezing-a-rubygnome-gui/241906/3 "2015-05-12T12:30:14Z")

</div>

Robert H. wrote in post #1173363:

> Hi guys,

see :

[https://www.ruby-forum.com/topic/125038#new](https://www.ruby-forum.com/topic/125038#new)

---

<div class="post-metadata">

**Author:** ![quik77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/q/dec6dc/32.png) [@quik77](https://www.ruby-forum.com/u/quik77)\
**Post date:** [May 12, 2015, 3:48pm UTC](https://www.ruby-forum.com/t/how-to-avoid-freezing-a-rubygnome-gui/241906/4 "2015-05-12T15:48:12Z")

</div>

and:  
[https://www.ruby-forum.com/topic/4417086#new](https://www.ruby-forum.com/topic/4417086#new)
