Question about Tkinter windows

Hendrik van Rooyen mail at microcorp.co.za
Fri Dec 22 00:49:51 EST 2006


Manuel Malo de Molina wrote:


>Hi everyone, this is the first time I use Python. I'm working on an application
>using Tkinter and I would like that
>the windows could only be opened once, is
>there any option to get that?
>
>I don't know if I've explained myself: what I want is that if the user clicks
>on "Options", for example, and he
 >doesn't close the options window, even if he
>clicks again on the same button the window doesn't open again.
>
>Oh, I forgot, the windows are toplevel.

Welcome to the wonderful world of Python hacking.

1) you can disable the button (at the start of the command bound to the button)
or,

2) in the same place, you can use configure to change the button's command
binding to a routine that does nothing and just returns

Don't forget to reverse whatever changes you have
made when the user closes the window, or it will
be a "one-shot" system.

-HTH - Hendrik





More information about the Python-list mailing list