[Tkinter-discuss] .mainloop(), what's the parameter for?

mkieverpy at tlink.de mkieverpy at tlink.de
Tue Nov 20 10:21:31 CET 2007

Hi Ron,

I didn't know that parameter either, so I thought I'd take a look.
I found the following loop in 'Tkapp_MainLoop' in '_tkinter.c':

while (Tk_GetNumMainWindows() > threshold &&
      !quitMainLoop &&

The parameter 'n' is the 'threshold' in the above 'if'.
If I understand the man-page of 'Tk_GetNumMainWindows' right
the code above drops out of the 'mainloop' when the
number of toplevel windows drops to 'threshold' or below.

Has anyone used this for values other than '0'?
I have never seen code using this.
What is the idea? Close the application when one of the
main windows gets closed?

Matthias Kievernagel

More information about the Tkinter-discuss mailing list