My Tkinter Threading nightmare

Paul Rubin http
Thu Jan 25 07:35:13 EST 2007


half.italian at gmail.com writes:
> >              try:
> >                 func, args, kw = self.cmd_queue.get(block=False)
> >              except QueueEmpty:
> >                 return
> >              func (*args, **kw)

> 
> 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?

   self.progressWindow.protocol('WM_DELETE_WINDOW', self.callback)

becomes

   gui.cmd_queue.put(self.progressWindow.protocol,
                      ('WM_DELETE_WINDOW', self.callback))

where gui is the Window object containing your gui.

I think there are some recipes like this in ASPN, that give more
detail about how to do this stuff.



More information about the Python-list mailing list