Chapter 8. Application Windows

Table of Contents
Base Windows
Menus
Toolbars
Status Bars

Base Windows

In the simple examples we've used this far, there's only one window on the screen; the root window. This is automatically created when you call the Tk constructor, and is of course very convenient for simple applications:

    from Tkinter import *

    root = Tk()
    
    # create window contents as children to root...
    
    root.mainloop()

If you need to create additional windows, you can use the Toplevel widget. It simply creates a new window on the screen, a window that looks and behaves pretty much like the original root window:

    from Tkinter import *
    
    root = Tk()
    
    # create root window contents...
    
    top = Toplevel()
    
    # create top window contents...
    
    root.mainloop()

There's no need to use pack to display the Toplevel, since it is automatically displayed by the window manager (in fact, you'll get an error message if you try to use pack or any other geometry manager with a Toplevel widget).