Re: Question about Tkinter windows

2006-12-22 Thread Hendrik van Rooyen

Manuel Malo de Molina  wrote in an email:

Hi, thanks for answering. The problem is that the window
can be closed in many ways (including some not
controlled by the program, as the X on the top right), 
is there a way to capture the window closing event?

Please keep it on the list so that other people can see it later
in searches...

You should be able to do this with a try ... finally - I don't, 
however, have any experience of this as I have never used it.

Maybe some one else can give a definite answer?

- Hendrik



-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Question about Tkinter windows

2006-12-21 Thread Hendrik van Rooyen
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


-- 
http://mail.python.org/mailman/listinfo/python-list