stopping tkinter callbacks
Fredrik Lundh
effbot at telia.com
Wed Aug 30 03:48:00 EDT 2000
bob wrote:
> Is it possible to stop the callback/binding in tkinter for a moment
> which some other stuff is going on. Here's my problem:
>
> - A button or menu is bound to the function Spam
> - when Spam is called it has to create a complicated window. This
> takes a second or so. Once the window is created it
> grabs the focus, so hitting the button again is ignored
> since the window with the button is no longer active.
> - Life is wonderful
>
> However, if the user clicks the button a 2nd time while the Spam window
> is being created...2 (or more) windows are now created.
>
> So, in Spam I need to turn off binding handling until it grabs the
> focus. Ideas???
why not do a temporary grab to a dummy widget
(e.g. a label widget or a frame)?
dummy.grab_set()
...
dummy.grab_release()
:::
if it's okay to explicitly disable just the launch button,
you can use bindtags:
tags = launch.bindtags()
launch.bindtags("none")
...
launch.bindtags(tags)
</F>
<!-- (the eff-bot guide to) the standard python library:
http://www.pythonware.com/people/fredrik/librarybook.htm
-->
More information about the Python-list
mailing list