[Tutor] closing the window through code

Alan Gauld alan.gauld at yahoo.co.uk
Sun Oct 1 20:12:07 EDT 2017

On 01/10/17 19:36, Max Patient wrote:

> my task is to create a password checker and one of the 
> criteria is to have a quit option. 

What does the quit do?
Quit the login? or quit the application?
Based on your subject line I'm assuming
just quit the login - but then how would
you do anything in  the app?

You don't say what GUI framework you are
using (and from the subject I assume it
is a GUI?) but most have some kind of
quit function. For example in Tkinter
there is a quit() method in the top level
widget and inherited by all the lower
level ones.

If you do just want to close a window/dialog
the normal approach is just to make it invisible.
In Tkinter that's done using the withdraw()
method of a window. (restore it with deiconify())

Other frameworks will have their equivalent
methods/functions. In some GUIs it's the window's
state value that controls visibility.

Alan G
Author of the Learn to Program web site
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list