我曾尝试使用Google搜索,但每个人的代码结构似乎都完全不同。我了解基本级别的tkinter,但是我不了解人们如何使用类和def交换页面。如何从主窗口切换到第二个窗口? (并且在关闭主电源后不能打开第二个))
import tkinter as tk
main = tk.Tk()
main.title("Main Program")
firstlabel = tk.Label(main, text="This is a program!")
firstlabel.pack()
main.mainloop()
second = tk.Tk()
second.title("Second Program")
firstlabel = tk.Label(second, text="This is another program!")
firstlabel.pack()
second.mainloop()
我曾尝试使用Google搜索,但每个人的代码结构似乎都完全不同。我了解基本级别的tkinter,但是我不了解人们如何使用类和def的...
尝试此::::
一种方法是使用此功能清除所有内容(每个小部件):