[英]How to change the content of a tkinter window?
How can I change my Tkinter window's content?如何更改 Tkinter 窗口的内容? Like a webpage where you click buttons to go to different places?
就像一个网页,你点击按钮到 go 到不同的地方?
(Preferably without classes) (最好不上课)
Your question is quite vague, but I believe the ttk.Notebook
widget may be of use.你的问题很模糊,但我相信
ttk.Notebook
小部件可能有用。 Here is an example of how to have different tabs of content:以下是如何拥有不同内容选项卡的示例:
from tkinter import *
from tkinter.ttk import *
root = Tk()
tabmanager = Notebook(root)
tabmanager.pack(expand=1,fill="both")
tab1 = Frame(tabmanager)
tab2 = Frame(tabmanager)
tabmanager.add(tab1,text="Home")
tabmanager.add(tab2,text="About")
root.mainloop()
You can then add whatever widgets you like to the frames.然后,您可以将您喜欢的任何小部件添加到框架中。 Hopefully this answers your question;
希望这能回答您的问题; let me know if you need more help:)
如果您需要更多帮助,请告诉我:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.