Was there ever an answer to this?  I'd be very curious to find out, too,
as I've been putting off the networking/threading part of my
application.

Are there any toy examples out there where a pygtk app listens to the
network and allows user input at the same time?  Maybe the simplest
thing would be a little chat window with a space where it shows the last
incoming message, and a textentry and Send button to send an outgoing
message.

sjbrown

On Fri, 2002-07-05 at 16:16, icewind wrote:
> 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/


Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to