无法跳转
from tkinter import Tk
import tkinter as tk
from MinaPage import MianPage
my_window = Tk()
my_window.title('登陆')
scree_width, screen_height = my_window.maxsize()
width = 250
height = 200
align_str = '%dx%d+%d+%d' % (width, height, (scree_width-width)/2, (screen_height-height)/2)
my_window.geometry(align_str)
my_window.resizable(width=False, height=False)
user_name_label = tk.Label(my_window, text='智能康复检查监督系统', font=('FangSong', 14))
user_name_label.place(x=28, y=30)
def log(self):
self.page.destroy()
MianPage(self.root)
user_login_button = tk.Button(my_window, text='用户', font=('FangSong', 10), command=log)
user_login_button.place(x=28, y=100)
my_window.mainloop()
另一页
import tkinter as tk
from views import AboutFrame
class MianPage:
def init(self,master:tk.Tk):
self.root = master
self.root.title('智能康复检查监督系统 v0.0.1')
self.root.geometry('600x400')
self.create_page()
def create_page(self):
self.about_frame = AboutFrame(self.root)
# tk.Label(self.about_frame, text='关于作品:本作品由tkinter制作').pack()
# tk.Label(self.about_frame, text='关于作者:无').pack()
menubar = tk.Menu(self.root)
menubar.add_command(label='录入')
menubar.add_command(label='结果')
menubar.add_command(label='关于', command=self.show_about)
self.root['menu'] = menubar
def show_about(self):
self.about_frame.pack()
if name == 'main':
root = tk.Tk()
MianPage(master=root)
root.mainloop()