python-3.x - 怎么不开窗
问题描述
from tkinter import *
def firstPage():
def goSecond():
root.destroy()
secondPage()
root = Tk()
text = Label(root, text="1")
text.pack()
btn = Button(root, text="go to 2", command=goSecond)
btn.pack()
root.mainloop()
def secondPage():
def goFirst():
root.destroy()
firstPage()
root = Tk()
text = Label(root, text="2")
text.pack()
btn = Button(root, text="go to 1", command=goFirst)
btn.pack()
root.mainloop()
firstPage()
我制作了这段代码,我希望它打开一个新页面,但它会打开一个新窗口,我明白为什么但我不知道如何打开页面而不是打开一个窗口。
解决方案
推荐阅读
- python - 使用 selenium 和 python 自动下载 .csr 文件
- oracle - SQL*Loader-522:lfiopn 因文件错误而失败
- java - JPA - 复合键识别中的关系
- python-3.x - 在pycharm中调试时出现“ModuleNotFoundError”
- postgresql - 与 postgresql 中的 btree 索引相比,brin 索引在非时态数据上的表现如何?
- react-native - React Native 将数据传递给同一文件上的另一个组件
- java - 在独立服务器上部署 Spring Boot 时出现 java.lang.ClassCastException 问题
- reactjs - 列表中的每个孩子都应该有一个唯一的“关键”道具布尔玛
- apache-kafka - 回复KafkaTemplate没有得到回复
- java - 配置 JMX 导出器时 Kafka 无法启动