import tkinter as tk from tkinter import messagebox from 家居信息 import JiaJuPage class MainPage: def __init__(self, master): self.root = master self.page = tk.Frame(self.root) self.page.pack() self.root.geometry('600x400') self.create_page() def create_page(self): # 创建一个标签用于展示简单的家居信息标题 self.home_info_title = tk.Label(self.page, text="主页面区", font=("Helvetica", 16)) self.home_info_title.pack(pady=20) # 添加一个按钮用于跳转到家居信息页面 self.goto_jiaju_button = tk.Button(self.page, text="家居信息", command=self.show_jiaju_info) self.goto_jiaju_button.pack(pady=10) def show_jiaju_info(self): # 销毁当前页面 self.page.destroy() # 显示家居信息页面 JiaJuInfoPage(self.root) class JiaJuInfoPage: def __init__(self, master): self.root = master self.page = tk.Frame(self.root) self.page.pack() self.root.geometry('600x400') JiaJuPage(self.root) if __name__ == '__main__': root = tk.Tk() app = MainPage(root) root.mainloop()