How to Open a New Window With a Button in Python Tkinter
In this tutorial, we are going to see how to open a new window with a button in Python Tkinter. Usually we use tk.Tk() to create a new Tkinter window, but this is not valid if we have already created a root window.
How to Open a New Window With a Button in Python Tkinter
In the following example, we will use the Toplevel widget, because the Toplevel widget is intended to display additional ‘pop-up’ windows.
[st_adsense]
from tkinter import * def create(): win = Toplevel(root) root = Tk() root.geometry('200x100') btn = Button(root, text="Create a new window", command = create) btn.pack(pady = 10) root.mainloop()
Output:

[st_adsense]
Excelente trabajo felicitaciones