[Tutor] Why does "window = tk.Tk()" open a tkinter window when typed in the Python interpreter?

boB Stepp robertvstepp at gmail.com
Fri Aug 28 16:38:15 EDT 2020


On Fri, Aug 28, 2020 at 2:48 AM Alan Gauld via Tutor <tutor at python.org> wrote:
>
> On 28/08/2020 02:34, boB Stepp wrote:
>
> > 3.8.3:  import tkinter as tk
> > 3.8.3:  window = tk.Tk()
> >
> > A tkinter window opens despite there being no explicit call to
> > window.mainloop().  Why is this so?
>
> Because it's what Tcl/Tk does...

Perhaps I should phrase the question differently:  Why does this
happen in the interpreter but does *not* happen if I run a program
without calling window.mainloop()?

-- 
boB


More information about the Tutor mailing list