My Tkinter Threading nightmare

Paul Rubin http
Thu Jan 25 04:35:05 CET 2007


Paul Rubin <http://phr.cx@NOSPAM.invalid> writes:
>       def idle(self):
>          # read and execute any commands waiting on the queue
>          while True:
>             try:
>                func, args, kw = self.cmd_queue.get(block=False)
>             except QueueEmpty:
>                return
>             func (*args, **kw)

Whoops, I forgot, you have to set up the after event again at the end
of this:

       def idle(self):
          # read and execute any commands waiting on the queue
          while True:
             try:
                func, args, kw = self.cmd_queue.get(block=False)
             except QueueEmpty:
                return
             func (*args, **kw)
          self.after(20, self.idle)



More information about the Python-list mailing list