In Python 3, I run the following from the interactive shell:
>>> import tkinter
>>> type(tkinter.Tk())
<class 'tkinter.Tk'>
>>> type(tkinter.Toplevel())
<class 'tkinter.Toplevel'>
Both of these create individual windows. I assume that tkinter.Tk()
returns the "main" window of the tkinter app, while any additional windows should be created with tkinter.Toplevel()
.
I noted that if you close tkinter.Tk()
's window, both windows close. Also, if you call tkinter.Toplevel()
without a call to tkinter.Tk()
, two windows are created (one of them being the "main" window that, when closed, will also close the Toplevel window).
Is this accurate? Are there any other differences that I should be concerned with?
Tk
is the whole app andToplevel
is just a window. – Lenorelenox