[pygtk] Threads in PyGTK: keep typing while ping-ing

?????? ?????? avi at tula.net
Wed Feb 18 04:53:52 WST 2009


Mamahita Sela ?????:
> (I am using 2.5.1, pygtk 2.10.6 on Linux x86)
> 
> This is my code:
> import threading
> import commands
> import gtk
> import gobject
> 
> gobject.threads_init()
I prefer gtk.gdk.threads_init()
...
> 
> 
> if __name__ == '__main__':
>    app = Main()
      gtk.gdk.threads_enter()  # !!!!!!!!!!!!!
>    gtk.main()
      gtk.gdk.threads_leave()  # !!!!!!!!!!!!!

For use with the GUI
gobject.idle_add(...
or
gtk.gdk.threads_enter()
# Your change to the GUI
gtk.gdk.threads_leave()

--
   Andrew Ivanov.



More information about the pygtk mailing list