PythonCard timer/thread tutorial

Sponge Nebson nebson at gmail.com
Wed Dec 24 17:56:45 EST 2008


Hello all,

This is my first post. Nice to meet you all! Could one of you walk me
through this code?

   def myThread(*argtuple):
        """
        A little thread we've added
        """
        print "myThread: entered"
        q = argtuple[0]
        print "myThread: starting loop"
        x = 10
        while True:
            time.sleep(10) # time unit is seconds
            print "myThread x=%d" % x
            q.put(str(x)) # stick something on message queue
            wx.WakeUpIdle() # triggers 'idle' handlers
            x += 10

It is from David McNab and Alex Tweedly's tutorial on timers and
threads, which can be found here:

 http://pythoncard.sourceforge.net/timers-threads.html

Among my questions are:
""" A little thread we've added""" seems to be an isolated string. It
does not seem to be doing anything there, almost like a comment. Why
is it there?

What is argtuple for? how does it work?

What is the queue for?

Thanks!

-Ben



More information about the Python-list mailing list