Hello,

I'm writing a gui program using pygtk that needs to
use threads and I'm not quite sure how to proceed.

Currently, when main gets executed, it creates and
runs an instance of a class called Driver. Driver
currently does three things. First, it instantiates a
view class that creates the pygtk interface. Second,
it creates a thread (a python class that is derived
from threading.Thread) to send out network packets
every 30 sec and starts it. Third, it starts another
thread that listens for network packets. Lastly, I
enter the gtk main loop.

I have a few questions regrading this setup:

1. My delete_event signal handler calls
gtk.mainquit(). This causes the GUI to disappear.
However, the threads that do the network stuff are
still running... How should I kill them when I get a
delete_event signal? After gtk.mainloop()?

2. How can I let the network threads access the gui
properly? (to display something when a packet comes
in, etc.) Do I need to use gtk.enter_thread() and
gtk.leave_thread() for this?

3. Are there any other issues that I should be aware
of when doing something like this or design
suggestions that anyone wants to offer?

Any help is appreciated!



__________________________________________________
Do You Yahoo!?
Sign up for SBC Yahoo! Dial - First Month Free
http://sbc.yahoo.com
_______________________________________________
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