My Tkinter Threading nightmare

half.italian at gmail.com half.italian at gmail.com
Thu Jan 25 06:58:40 EST 2007


On Jan 24, 7:35 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> Paul Rubin <http://phr...@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)

Thanks Paul.  That has made more sense than all of my scrounging
combined, but I still need to mess around with the idea and code some.
How can I put something like the window delete into the command queue?
Isn't window.protocol() just binding the close window button to a
function?

I'll look deeper and experiment and try to make sense of it once again
tomorrow.  :)

~Sean




More information about the Python-list mailing list