Hi I had this exact same question :
opening a new window with a button
But as I ran the code given : (EDIT : first line is indeed from tkinter import *)
from tkinter import *
def create_window():
window = Toplevel(root)
root = Tk()
b = Button(root, text="Create new window", command=create_window)
b.pack()
root.mainloop()
the new window opens automatically, without waiting for the button to be clicked
why is that?