tkinter automatically creates a TopLevel window for you, when you execute your first operation in tkinter. You can start with this first window, by referencing Tk().
1 import tkinter
2 root = tkinter.Tk()
3
Constructor
argument |
meaning |
screenName |
? |
baseName |
? |
className ='Tk' |
? |
useTk =1 |
? |
Notes
My understanding is that when you call Tk(), the widget you get back is effectively a TopLevel widget.
- What is the useTk option?
Hiding the Root Window
If you wanted to use tkinter without the UI -- perhaps, say, to read values from a GIF file, you can withdraw the Tk root window:
1 import tkinter
2 root = tkinter.Tk()
3 root.withdraw() # hide the window that appeared
4