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.
on 2015-05-10 21:23
on 2015-05-11 20:18
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.
on 2015-05-12 14:30
Robert H. wrote in post #1173363: > Hi guys, > see : https://www.ruby-forum.com/topic/125038#new