On Sat, Oct 05, 2002 at 08:28:40AM -0400, Steffen Ries wrote:
> class T(threading.Thread):
>     def run(self):
>         time.sleep(5)
>         gtk.threads_enter()
>         print "acquired GDK lock"
>         win = gtk.Window()
>         win.connect("destroy", lambda win: gtk.main_quit())
>         win.show()
>         gtk.threads_leave()
>         print "released GDK lock"
> 
> gtk.threads_init()
> 
> win = gtk.Window()
> win.connect("destroy", lambda win: gtk.main_quit())
> win.show()
> 
> t = T()
> t.start()

t.run() vs t.start()?

Also, if I'm not mistaken locking is only important inside the mainloop;
while you are out of it things should work as expected. You should
protect GTK code that runs in handlers (though not signal handlers, as
James points out).

Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/

Reply via email to