[英]Switching between windows in tkinter
First I have open main window then through that I have another window called order .Now I have to make a button that get to the main window again首先我打开了主窗口,然后我有另一个名为 order 的窗口。现在我必须制作一个再次进入主窗口的按钮
def back():
wn.destroy()
import purchase
Button(text="Back",width='30',height='5',command=back,fg='black',bg='green',bd='5',font=(40),command=back).place(x='100',y='600')
You need to make the button start a function to open the window.您需要让按钮启动一个功能来打开窗口。
Ex.前任。
def OpenNewWindow:
newWindow = TopLevel(master)
B1 = tk.Button(text="example", command = OpenNewWindow
B1.pack()
Treat it like a normal window: geometry, title, etc.像普通窗口一样对待它:几何、标题等。
but remember one thing: KEEP THE TOPLEVEL IN THE MAIN LOOP但请记住一件事:在主循环中保持顶部
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.