Tkinter example code for multiple windows, why won't buttons load correctly?
问题 I am writing a program which should: Open a window with the press of a button. Close the newly opened window with the press of another button. I'm using classes so I can insert the code into a larger program later. However, I can't get my buttons to load correctly. import tkinter as tk class Demo1(tk.Frame): def __init__(self): tk.Frame.__init__(self) self.pack() self.master.title("Demo 1") self.button1 = tk.Button(self, text = "Button 1", width = 25, command = self.new_window) self.button1