From: Alex Fenton Date: 2005-12-07T21:07:35+09:00 Subject: Re: wxruby and threads Hello Yuri Kozlov wrote: > Thread.new do > loop { > puts 'hello' > STDOUT.flush > sleep(1) > } > end > > MinimalApp.new.main_loop I don't know exactly how ruby's threads interact with wx's scheduling. Perhaps you could try adding an evt_idle handler to your example? For me this does what I'd expect: fire regularly and spawn and run threads fine. What I didn't expect, but that happened anyway, is that your original long-running Thread now also seems to run regularly regardless of app focus. Maybe add an explicit call to thread.run() in the on_idle handler? alex require 'thread' require 'wx' class MinimalApp < Wx::App def on_idle Thread.new do puts 'FOO' STDOUT.flush sleep(1) end end def on_init evt_idle { on_idle } f = Wx::Frame.new( nil, -1,'Test' ) f.show end end $t = Thread.new do loop { puts 'BAR' STDOUT.flush sleep(1) } end MinimalApp.new.main_loop