From the course: Python GUI Development with Tkinter

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Creating additional top-level windows

Creating additional top-level windows

From the course: Python GUI Development with Tkinter

Start my 1-month free trial

Creating additional top-level windows

- [Instructor] We've already seen that when we call the Tk constructor method, it automatically creates a new window for us to begin adding widgets to. If we want to add additional windows to our program, we can do so with the top-level window widget. Each top-level window we create is it's own Tk widget object, which we can use as the parent and geometry manager for other widgets. You can use new top-level windows to create entire new GUI sections for your program, or even just display a simple pop-up message for the user. I'll begin by importing the tkinter module using the from tkinter package command, but I'm not going to import the themed ttk module, because top-level windows are not part of the themed widget set. I'm then going to use the Tk constructor method to create my root top-level window here. And now if I wanted to create a second top-level window, I can do so with the Toplevel window constructor. Notice that the T is capitalized, but the l is lowercase. And I'm going to…

Contents