Re: [pygtk] Pygtk toggle hide show with time interval
hi. import gtk, pygtk pygtk.require('2.0') import time class test(): def __init__(self): self.window=gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect=('delete_event',lambda wid, we: gtk.main_quit()) self.window.show() gtk.gdk.flush() print show time.sleep(2) self.window.hide() gtk.gdk.flush() print hide time.sleep(3) self.window.show() print show if __name__ == __main__: test() gtk.main() Regards. Cristian ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] Pygtk toggle hide show with time interval
On Sat, May 7, 2011 at 2:02 AM, craf pyclut...@gmail.com wrote: hi. import gtk, pygtk pygtk.require('2.0') import time class test(): def __init__(self): self.window=gtk.Window(gtk.WINDOW_TOPLEVEL) self.window.connect=('delete_event',lambda wid, we: gtk.main_quit()) self.window.show() gtk.gdk.flush() print show time.sleep(2) self.window.hide() gtk.gdk.flush() print hide time.sleep(3) self.window.show() print show if __name__ == __main__: test() gtk.main() Hey thats working, Thanx and can you please explain me why shall I use this flush. I just read that gtk.gdk.flush()http://pygtk.org/docs/pygtk/gdk-functions.html#function-gdk--flushcreates output and wait until sll requests are processed what does that actually mean Regards. Cristian Regards phanindra ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] Pygtk toggle hide show with time interval
Hey thats working, Thanx and can you please explain me why shall I use this flush. I just read that gtk.gdk.flush() creates output and wait until sll requests are processed what does that actually mean Dont write code like this. 1) time.sleep() blocks the mainloop and your program basically stops (which is useless and not a good idea in the real world) 2) flush() forces the main loop to run until events are processed, thus showing your window. But then it stops again during sleep. See #1 If you want to achieve delays in a gtk program use glib/gobject.timeout_add John Regards. Cristian Regards phanindra ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/
Re: [pygtk] Pygtk toggle hide show with time interval
On Sat, May 7, 2011 at 3:20 AM, John Stowers john.stowers.li...@gmail.comwrote: Hey thats working, Thanx and can you please explain me why shall I use this flush. I just read that gtk.gdk.flush() creates output and wait until sll requests are processed what does that actually mean Dont write code like this. 1) time.sleep() blocks the mainloop and your program basically stops (which is useless and not a good idea in the real world) 2) flush() forces the main loop to run until events are processed, thus showing your window. But then it stops again during sleep. See #1 If you want to achieve delays in a gtk program use glib/gobject.timeout_add ohk thanks John Regards. Cristian Regards phanindra ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/ ___ pygtk mailing list pygtk@daa.com.au http://www.daa.com.au/mailman/listinfo/pygtk Read the PyGTK FAQ: http://faq.pygtk.org/