On Mon, 23 Oct 2000 16:21:29 -0400,
"Kohli, Ranjan" <[EMAIL PROTECTED]> said:

    > My question is do you really need to use threads in a PyGTK
    > application. If you do, could someone please point me to
    > some documentation/tutorial that could introduce it to me.

Need? That depends entirely on what you want to do. If you're
writing something like an FTP client or web browser, you'd want
each window/connection to have its own thread so as not to slow
down the entire interface.

As for tutorials, threading in Python is simple if you already
understand threads. If you don't, i recommend you pick up the
excellent _Programming with Posix Threads_.

There is only one extra detail when using GTK+ in a
multi-threaded application. It is often simpler just to have one
GUI thread, but if your other threads must access the GUI, they
need to call threads_enter() before using any GTK+ functions and
threads_leave() afterwards. You don't have to do this in
callbacks, howerver, as GTK+ acquires the lock for you in that
case. IO watchers, timeouts, etc. all require grabbing the lock
first, though.

-- 
Eric Gillespie, Jr. <*> [EMAIL PROTECTED]
Software Developer
Progeny Linux Systems - http://progeny.com


_______________________________________________
pygtk mailing list   [EMAIL PROTECTED]
http://www.daa.com.au/mailman/listinfo/pygtk

Reply via email to