From: Jacek Podkanski Date: 2001-12-16T15:55:05+09:00 Subject: [ruby-talk:28663] Re: GUI testing with GTK? Massimiliano Mirra wrote: > I see GTK::Widget has got an add_events(events) method. I believed it > was a way to add events to the widget's queue, including clicks and > other user actions, so I rejoiced. > > But either I misinterpreted it or I cannot guess how to use it. From > the following code snippet, I would expect that the window would close > after two seconds, which it does not. > > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > require 'gtk' > > window = Gtk::Window.new(Gtk::WINDOW_TOPLEVEL) > window.signal_connect('delete_event') { exit } > window.show > > Thread.new { sleep 2; window.add_events('delete_event') } > > Gtk.main > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > The GTK API reference on ruby-lang does not describe add_events, and I > could not get anything useful out of the gtk-reference (still too much > of a C kid I'm afraid). > > Massimiliano Try that Regards Jacek #!/usr/bin/ruby require 'gtk' window = Gtk::Window.new(Gtk::WINDOW_TOPLEVEL) window.signal_connect('delete_event') { sleep 2 #try to do it that way exit } window.show Gtk.main -- Jacek Podkanski