From: nobu.nokada@... Date: 2002-05-09T22:28:20+09:00 Subject: Re: Ruby/GTK with no window movement updates Hi, At Thu, 9 May 2002 22:00:13 +0900, Frank Murphy wrote: > Your fix worked fine, but I think you're right about the Gtk.timeout_add. > I've been trying to use that, but I keep freezing my whole X session and > have to kill it. Oops, it's X's or kernel's issue, perhaps. > There aren't any examples with Ruby on the Ruby/GTK site, > and the gtk.org site isn't much better. Does anyone know where I can find > some examples using Gtk.timeout_add? This is a script I played from yours. Note the returned value from timeout_add'ed proc, when evaluated as true the proc will be called again, otherwise removed. #!/usr/bin/ruby require 'gtk' window = Gtk::Window.new() button1 = Gtk::Button.new('Move World') button2 = Gtk::Button.new('Quit') vbox = Gtk::VBox.new(false, 0) vbox.pack_start button1, true, true, 0 vbox.pack_start button2, true, true, 0 count = 0 move = proc { window.set_uposition(count, count) print "Moving World\n" if (count += 1) < 50 true else count = 0 false end } exit = proc {exit(0)} button1.signal_connect('clicked') { Gtk.timeout_add(0.1, &move) count = 0 move.call } button2.signal_connect('clicked', &exit) window.signal_connect('destroy', &exit) window.set_title 'hello' window.add vbox button1.show button2.show vbox.show window.show Gtk.main -- Nobu Nakada