```python
from tkinter import *
from asd import *
class studentClass():
def __init__(self,master):
Button(master, "这是学生管理界面").pack()
class adminClass():
def __init__(self,master):
Label(master, "这是招聘管理界面").pack()
class scoreClass():
def __init__(self,master):
Label(master, "这是打分管理界面").pack()
class journalClass():
def __init__(self,master):
Label(master, "这是日志管理").pack()
class discussClass():
def __init__(self,master):
Label(master, "这是讨论区").pack()
root=Tk()
root.geometry("700x500")
frame=Frame(root,width=100,height=500,highlightbackground="#668B8B", highlightthickness=3)
frame.config(background="#96CDCD")
frame.pack(fill=Y, side=LEFT)
bai=Label(frame)
student=Label(frame,text="学生系统", font=("微软雅黑", 14),fg="white",bg="#96CDCD")
student.place(x=5,y=30)
admin=Label(frame,text="招聘系统" ,font=("微软雅黑", 14),fg="white",bg="#96CDCD")
admin.place(x=5,y=120)
score=Label(frame,text="打分管理" ,font=("微软雅黑", 14),fg="white",bg="#96CDCD")
score.place(x=5,y=210)
journal=Label(frame,text="日志管理" ,font=("微软雅黑", 14),fg="white",bg="#96CDCD")
journal.place(x=5,y=300)
discuss=Label(frame,text="讨论区" ,font=("微软雅黑", 14),fg="white",bg="#96CDCD")
discuss.place(x=5,y=390)
stuFrame=Frame(root)
admFrame=Frame(root)
scoFrame=Frame(root)
jouFrame=Frame(root)
disFrame=Frame(root)
def stuFuntion(event=None):
studentClass(stuFrame)
stuFrame.pack()
admFrame.pack_forget()
scoFrame.pack_forget()
jouFrame.pack_forget()
disFrame.pack_forget()
def admFuntion(event=None):
adminClass(admFrame)
admFrame.pack()
stuFrame.pack_forget()
scoFrame.pack_forget()
jouFrame.pack_forget()
disFrame.pack_forget()
def scoFuntion(event=None):
scoreClass(scoFrame)
scoFrame.pack()
stuFrame.pack_forget()
jouFrame.pack_forget()
disFrame.pack_forget()
admFrame.pack_forget()
def jouFuntion(event=None):
journalClass(jouFrame)
jouFrame.pack()
stuFrame.pack_forget()
disFrame.pack_forget()
admFrame.pack_forget()
scoFrame.pack_forget()
def disFuntion(event=None):
discussClass(disFrame)
disFrame.pack()
stuFrame.pack_forget()
disFrame.pack_forget()
admFrame.pack_forget()
scoFrame.pack_forget()
student.bind("<Button-1>",stuFuntion)
admin.bind("<Button-1>",admFuntion)
score.bind("<Button-1>",scoFuntion)
journal.bind("<Button-1>",jouFuntion)
discuss.bind("<Button-1>",disFuntion)
root.title("学生管理系统")
root.mainloop()
出现报错,页面不能正常跳转
报错信息:
Exception in Tkinter callback
Traceback (most recent call last):
File "D:\python39\Lib\tkinter\__init__.py", line 1967, in __call__
return self.func(*args)
^^^^^^^^^^^^^^^^
File "C:\Users\32756\PycharmProjects\TTK\db.py", line 77, in admFuntion
adminClass(admFrame)
File "C:\Users\32756\PycharmProjects\TTK\db.py", line 12, in __init__
Label(master, "这是招聘管理界面").pack()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\python39\Lib\tkinter\__init__.py", line 3231, in __init__
Widget.__init__(self, master, 'label', cnf, kw)
File "D:\python39\Lib\tkinter\__init__.py", line 2644, in __init__
classes = [(k, v) for k, v in cnf.items() if isinstance(k, type)]
^^^^^^^^^
AttributeError: 'str' object has no attribute 'items'
```