Thread.pass…

zyps_demo is locking up the interface so that it won’t respond to window close events until the demo is done. The zyps executable itself will presumably lock up as well. But via a Google search, Alex Fenton has (inadvertently) helped me out a second time…

“using Wx::Timer + Thread.pass + evt_timer inside App#on_init seems to work well on OS X (dev, not 0.0.39), GTK (both) and Windows (both).”

The problem is present in my brief wxRuby test as well, so here’s a revised version of that, which plays much nicer…

require 'rubygems'
require 'wx'

class MyApp < Wx::App

  def on_init

    #Animate every 55 seconds.
    t = Wx::Timer.new(self, 55)
    evt_timer(55) { Thread.pass }
    t.start(33)

    #Window/buffer setup code...

    #Animate.
    Thread.new do
      (1..300).each do |i|
        #Animation code...
      end
    end

  end

  #def update_window...

end

app = MyApp.new
app.main_loop