[pygtk] PyGtk, Standard way to thread?
squabbit7 at gmail.com
Sun Jun 17 05:30:07 WST 2007
You can use the threading module to create a thread class, and then call its
class my_thread( threading.Thread ):
def __init__( self, channel, details ):
threading.Thread.__init__ ( self ) ##you need this
self.my_args =3D "hello"
def run ( self ): ## this is them method that gets called when you
.... ##call start() on your thread object.
allot of people use an infinite loop in their run method, something like
"while not self.kill"
and have kill as an event object,
or if you just want to thread one function...
make sure you use the gtk threads enter, and threads leave methods if your
doing anything with the
interface, as well as gtk threads init some where before you start gtk main.
On 6/16/07, NewbieNoob <optomatic at rogers.com> wrote:
> Hi Everyone
> I have been going around in circles for weeks now, I would love some help.
> Is there a standard way to thread or otherwise divide tasks with PyGtk.
> I know you can use:
> -the thread module
> -the threading module
> -the Queue module
> -the Gtasklets module with pseudo threads
> -the time module to time different tasks.
> I want to control instruments through a serial port, plot data from them
> still have a responsive GUI. I am pretty sure I will need to thread these
> It seems that most people think threads are very difficult or just plain
> evil. Is there a fairly straight forward way to accomplish these sorts of
> I would really appreciate any help you could provide-Patrick
> View this message in context:
> Sent from the Gtk+ - Python mailing list archive at Nabble.com.
> pygtk mailing list pygtk at daa.com.au
> Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the pygtk