commit
6207a9f4b5
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Python 3.12 (pythonProject) (2)" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.12 (pythonProject) (2)" project-jdk-type="Python SDK" />
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/pythonProject.iml" filepath="$PROJECT_DIR$/.idea/pythonProject.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/venv" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.12 (pythonProject) (2)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,3 @@
|
||||
# Default ignored files
|
||||
/shelf/
|
||||
/workspace.xml
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="jdk" jdkName="Python 3.10" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
@ -0,0 +1,12 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="PyUnresolvedReferencesInspection" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="ignoredIdentifiers">
|
||||
<list>
|
||||
<option value="xlwt" />
|
||||
</list>
|
||||
</option>
|
||||
</inspection_tool>
|
||||
</profile>
|
||||
</component>
|
@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.10" project-jdk-type="Python SDK" />
|
||||
</project>
|
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/HumanManage.iml" filepath="$PROJECT_DIR$/.idea/HumanManage.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$/.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
@ -0,0 +1,392 @@
|
||||
from tkinter import *
|
||||
import tkinter.messagebox as mb
|
||||
import _sqlite3
|
||||
|
||||
import Managerview # 管理员菜单栏对应的各个子页面
|
||||
import Teacherview # 教师菜单栏对应的各个子页面
|
||||
import Studentview # 学生菜单栏对应的各个子页面
|
||||
|
||||
#连接数据库
|
||||
# conn = _sqlite3.connect(":memory:")
|
||||
conn = _sqlite3.connect("data.db")
|
||||
c = conn.cursor()
|
||||
|
||||
|
||||
def login_teacher(name):
|
||||
c.execute("select * from teachers where teachers.name = '%s'" % name)
|
||||
# 提交事务
|
||||
conn.commit()
|
||||
return c.fetchall()
|
||||
def login_student(name):
|
||||
c.execute("select * from students where students.name = '%s'" % name)
|
||||
# 提交事务
|
||||
conn.commit()
|
||||
return c.fetchall()
|
||||
|
||||
#登录窗体
|
||||
class LoginPage(object):
|
||||
def __init__(self, master=None):
|
||||
self.root = master # 定义内部变量root
|
||||
self.root.geometry('%dx%d' % (800, 610)) # 设置窗口大小
|
||||
self.usrrole = IntVar()
|
||||
self.usrrole.set(1)
|
||||
self.username = StringVar()
|
||||
self.username.set("admin")
|
||||
self.password = StringVar()
|
||||
self.createPage()
|
||||
def createPage(self):
|
||||
self.page = Frame(self.root) # 创建Frame
|
||||
self.page.pack()
|
||||
Label(self.page).grid(row=0, stick=W)
|
||||
Label(self.page, text="登录角色:").grid(row=1, stick=W, pady=10)
|
||||
Radiobutton(self.page, text="管理员", variable=self.usrrole, value=1, command=self.__setusrstr).grid(row=1, column=1, stick=W)
|
||||
Radiobutton(self.page, text="教师", variable=self.usrrole, value=2, command=self.__setusrstr).grid(row=1, column=2, stick=W)
|
||||
Radiobutton(self.page, text="学生", variable=self.usrrole, value=3, command=self.__setusrstr).grid(row=1, column=3, stick=W)
|
||||
Label(self.page, text='账户: ').grid(row=2, stick=W, pady=10)
|
||||
Entry(self.page, textvariable=self.username).grid(row=2, column=1, columnspan=2, stick=E)
|
||||
Label(self.page, text='密码: ').grid(row=3, stick=W, pady=10)
|
||||
Entry(self.page, textvariable=self.password, show='*').grid(row=3, column=1, columnspan=2, stick=E)
|
||||
Button(self.page, text='登陆', command=self.loginCheck).grid(row=4, columnspan=2, pady=10, stick=W)
|
||||
Button(self.page, text='退出系统', command=self.exitsys).grid(row=4, column=2, columnspan=2, stick=E)
|
||||
|
||||
#判断登录用户
|
||||
def loginCheck(self):
|
||||
role = self.usrrole.get()
|
||||
name = self.username.get()
|
||||
secret = self.password.get()
|
||||
if role == 1 and name == "admin" and secret == "123456":
|
||||
self.page.destroy()
|
||||
self.username.set('')
|
||||
self.password.set('')
|
||||
ManagerPage(name,self.root)
|
||||
mb.showinfo('登录成功', '欢迎:%s' % name)
|
||||
elif role == 2:
|
||||
login = login_teacher(name)
|
||||
if len(login) == 0:
|
||||
mb.showerror("登录失败","账号不存在")
|
||||
pth = login[0]
|
||||
print(pth)
|
||||
if name == pth[1] and secret == pth[0]:
|
||||
self.page.destroy()
|
||||
self.username.set('')
|
||||
self.password.set('')
|
||||
TeacherPage(name,secret, self.root)
|
||||
mb.showinfo('登录成功', '欢迎:%s' % name)
|
||||
else:
|
||||
mb.showinfo(title='错误', message='账号或密码错误!')
|
||||
elif role == 3:
|
||||
login = login_student(name)
|
||||
if len(login) == 0:
|
||||
mb.showerror("登录失败", "账号不存在")
|
||||
pth = login[0]
|
||||
print(pth)
|
||||
if name == pth[1] and secret == pth[0]:
|
||||
self.page.destroy()
|
||||
self.username.set('')
|
||||
self.password.set('')
|
||||
StudentPage(name, self.root)
|
||||
mb.showinfo('登录成功', '欢迎:%s' % name)
|
||||
else:
|
||||
mb.showinfo(title='错误', message='账号或密码错误!')
|
||||
else:
|
||||
mb.showinfo(title='错误', message='账号或密码错误!')
|
||||
self.username.set('')
|
||||
self.password.set('')
|
||||
|
||||
|
||||
def __setusrstr(self):
|
||||
self.username.set("admin")
|
||||
if self.usrrole.get() == 2:
|
||||
self.username.set("请输入工号")
|
||||
elif self.usrrole.get() == 3:
|
||||
self.username.set("请输入学号")
|
||||
|
||||
def exitsys(self):
|
||||
if mb.askyesno("退出系统", "你确定更要退出系统"):
|
||||
self.page.destroy()
|
||||
self.root.destroy()
|
||||
|
||||
#管理员窗体
|
||||
class ManagerPage(object):
|
||||
def __init__(self, name, master=None):
|
||||
self.root = master # 定义内部变量root
|
||||
self.usrname = name
|
||||
self.root.geometry('%dx%d' % (600, 400)) # 设置窗口大小
|
||||
self.createPage()
|
||||
#菜单栏
|
||||
def createPage(self):
|
||||
self.WelcomePage = Managerview.WelcomeFrame(self.usrname,self.root) # 创建不同Frame
|
||||
self.inputTeacherPage = Managerview.InputTeacherFrame(self.root)
|
||||
self.inputstudentPage = Managerview.InputStudentFrame(self.root)
|
||||
self.queryPage = Managerview.QueryFrame(self.root)
|
||||
self.maintainPage = Managerview.maintainFrame(self.root)
|
||||
self.UpdateKeywordPage = Managerview.UpdateKeywordFrame(self.root)
|
||||
self.WelcomePage.pack() # 默认显示欢迎界面
|
||||
menubar = Menu(self.root)
|
||||
self.menubar = menubar
|
||||
menu1 = Menu(self.root)
|
||||
menu1.add_command(label="创建教师账号", command=self.CreateTeacher)
|
||||
menu1.add_command(label="创建学生账号", command=self.CreateStudent)
|
||||
menu1.add_command(label="修改管理员密码", command=self.UpdateKeyword)
|
||||
menubar.add_cascade(label='账户权限管理', menu=menu1)
|
||||
menubar.add_command(label='信息查询', command=self.queryData)
|
||||
menubar.add_command(label='信息维护', command=self.maintain)
|
||||
menubar.add_command(label='退出登录', command=self.returnLogin)
|
||||
self.root['menu'] = menubar # 设置菜单栏
|
||||
|
||||
def UpdateKeyword(self):
|
||||
self.WelcomePage.pack_forget()
|
||||
self.inputTeacherPage.pack_forget()
|
||||
self.inputstudentPage.pack_forget()
|
||||
self.queryPage.pack_forget()
|
||||
self.maintainPage.pack_forget()
|
||||
self.UpdateKeywordPage.pack()
|
||||
|
||||
def CreateTeacher(self):
|
||||
self.WelcomePage.pack_forget()
|
||||
self.inputTeacherPage.pack()
|
||||
self.inputstudentPage.pack_forget()
|
||||
self.queryPage.pack_forget()
|
||||
self.maintainPage.pack_forget()
|
||||
self.UpdateKeywordPage.pack_forget()
|
||||
|
||||
def queryData(self):
|
||||
self.WelcomePage.pack_forget()
|
||||
self.inputTeacherPage.pack_forget()
|
||||
self.inputstudentPage.pack_forget()
|
||||
self.queryPage.pack()
|
||||
self.maintainPage.pack_forget()
|
||||
self.UpdateKeywordPage.pack_forget()
|
||||
|
||||
def maintain(self):
|
||||
self.WelcomePage.pack_forget()
|
||||
self.inputTeacherPage.pack_forget()
|
||||
self.inputstudentPage.pack_forget()
|
||||
self.queryPage.pack_forget()
|
||||
self.maintainPage.pack()
|
||||
self.UpdateKeywordPage.pack_forget()
|
||||
|
||||
def CreateStudent(self):
|
||||
self.WelcomePage.pack_forget()
|
||||
self.inputTeacherPage.pack_forget()
|
||||
self.inputstudentPage.pack()
|
||||
self.queryPage.pack_forget()
|
||||
self.maintainPage.pack_forget()
|
||||
self.UpdateKeywordPage.pack_forget()
|
||||
def returnLogin(self):
|
||||
self.WelcomePage.destroy()
|
||||
self.inputTeacherPage.destroy()
|
||||
self.inputstudentPage.destroy()
|
||||
self.queryPage.destroy()
|
||||
self.maintainPage.destroy()
|
||||
self.UpdateKeywordPage.destroy()
|
||||
self.menubar.destroy()
|
||||
LoginPage(self.root)
|
||||
#老师窗体类
|
||||
class TeacherPage(object):
|
||||
def __init__(self, name,secret, master=None):
|
||||
self.usrname = name
|
||||
self.password = secret
|
||||
self.root = master # 定义内部变量root
|
||||
self.root.geometry('%dx%d' % (600, 500)) # 设置窗口大小
|
||||
self.createPage()
|
||||
|
||||
def createPage(self):
|
||||
self.WelcomePage = Teacherview.WelcomeFrame(self.usrname, self.root) # 创建欢迎界面
|
||||
self.myPage = Teacherview.MyFrame(self.usrname,self.root)
|
||||
self.updatepwdPage = Teacherview.UpdatepwdFrame(self.usrname,self.root)
|
||||
self.inputPage = Teacherview.InputFrame(self.root) # 创建不同Frame
|
||||
self.queryPage = Teacherview.QueryFrame(self.root)
|
||||
self.countPage = Teacherview.CountFrame(self.root)
|
||||
self.count2Page = Teacherview.EditFrame(self.root)
|
||||
self.feedbackPage = Teacherview.FeedbackFrame(self.root)
|
||||
self.WelcomePage.pack() # 默认显示欢迎界面
|
||||
menubar = Menu(self.root)
|
||||
self.menubar = menubar
|
||||
menu1 = Menu(self.root)
|
||||
menu1.add_command(label='个人信息', command=self.myData)
|
||||
menu1.add_command(label='修改密码', command=self.updatepwdData)
|
||||
menubar.add_cascade(label='我的', menu=menu1)
|
||||
menubar.add_command(label='成绩录入', command=self.inputData)
|
||||
menubar.add_command(label='查询', command=self.queryData)
|
||||
menubar.add_command(label='统计', command=self.countData)
|
||||
menubar.add_command(label='编辑', command=self.count2Data)
|
||||
menubar.add_command(label='意见反馈', command=self.feedbackData)
|
||||
menubar.add_command(label= "教师"+self.usrname + '已登录,退出登录', command=self.returnLogin)
|
||||
self.root['menu'] = menubar # 设置菜单栏
|
||||
|
||||
def myData(self):
|
||||
self.inputPage.pack_forget()
|
||||
self.queryPage.pack_forget()
|
||||
self.countPage.pack_forget()
|
||||
self.feedbackPage.pack_forget()
|
||||
self.count2Page.pack_forget()
|
||||
self.myPage.pack()
|
||||
self.updatepwdPage.pack_forget()
|
||||
self.WelcomePage.pack_forget()
|
||||
|
||||
def updatepwdData(self):
|
||||
self.inputPage.pack_forget()
|
||||
self.queryPage.pack_forget()
|
||||
self.countPage.pack_forget()
|
||||
self.feedbackPage.pack_forget()
|
||||
self.count2Page.pack_forget()
|
||||
self.myPage.pack_forget()
|
||||
self.updatepwdPage.pack()
|
||||
self.WelcomePage.pack_forget()
|
||||
|
||||
def inputData(self):
|
||||
self.inputPage.pack()
|
||||
self.queryPage.pack_forget()
|
||||
self.countPage.pack_forget()
|
||||
self.feedbackPage.pack_forget()
|
||||
self.count2Page.pack_forget()
|
||||
self.myPage.pack_forget()
|
||||
self.updatepwdPage.pack_forget()
|
||||
self.WelcomePage.pack_forget()
|
||||
|
||||
def queryData(self):
|
||||
self.inputPage.pack_forget()
|
||||
self.queryPage.pack()
|
||||
self.countPage.pack_forget()
|
||||
self.feedbackPage.pack_forget()
|
||||
self.count2Page.pack_forget()
|
||||
self.myPage.pack_forget()
|
||||
self.updatepwdPage.pack_forget()
|
||||
self.WelcomePage.pack_forget()
|
||||
|
||||
def countData(self):
|
||||
self.inputPage.pack_forget()
|
||||
self.queryPage.pack_forget()
|
||||
self.countPage.pack()
|
||||
self.feedbackPage.pack_forget()
|
||||
self.count2Page.pack_forget()
|
||||
self.myPage.pack_forget()
|
||||
self.updatepwdPage.pack_forget()
|
||||
self.WelcomePage.pack_forget()
|
||||
|
||||
def count2Data(self):
|
||||
self.count2Page.pack()
|
||||
self.inputPage.pack_forget()
|
||||
self.queryPage.pack_forget()
|
||||
self.countPage.pack_forget()
|
||||
self.feedbackPage.pack_forget()
|
||||
self.myPage.pack_forget()
|
||||
self.updatepwdPage.pack_forget()
|
||||
self.WelcomePage.pack_forget()
|
||||
|
||||
def feedbackData(self):
|
||||
self.inputPage.pack_forget()
|
||||
self.queryPage.pack_forget()
|
||||
self.countPage.pack_forget()
|
||||
self.feedbackPage.pack()
|
||||
self.count2Page.pack_forget()
|
||||
self.myPage.pack_forget()
|
||||
self.updatepwdPage.pack_forget()
|
||||
self.WelcomePage.pack_forget()
|
||||
|
||||
def returnLogin(self):
|
||||
self.inputPage.destroy()
|
||||
self.queryPage.destroy()
|
||||
self.countPage.destroy()
|
||||
self.menubar.destroy()
|
||||
self.feedbackPage.destroy()
|
||||
self.count2Page.destroy()
|
||||
self.myPage.destroy()
|
||||
self.updatepwdPage.destroy()
|
||||
self.WelcomePage.destroy()
|
||||
LoginPage(self.root)
|
||||
#学生窗体类
|
||||
class StudentPage(object):
|
||||
def __init__(self, name, master=None):
|
||||
self.usrname = name
|
||||
self.root = master # 定义内部变量root
|
||||
self.root.geometry('%dx%d' % (600, 500)) # 设置窗口大小
|
||||
self.createPage()
|
||||
|
||||
def createPage(self):
|
||||
self.myPage2 = Studentview.MyFrame(self.usrname, self.root)
|
||||
self.updatepwdPage2 = Studentview.UpdatepwdFrame(self.usrname, self.root)
|
||||
self.inputPage = Studentview.InputFrame(self.root) # 创建不同Frame
|
||||
self.queryPage = Studentview.QueryFrame(self.root)
|
||||
self.countPage = Studentview.CountFrame(self.root)
|
||||
self.submitPage = Studentview.SubmitFrame(self.root)
|
||||
self.inputPage.pack() # 默认显示主界面
|
||||
menubar = Menu(self.root)
|
||||
self.menubar = menubar
|
||||
menu1 = Menu(self.root)
|
||||
menu1.add_command(label='个人信息', command=self.myData2)
|
||||
menu1.add_command(label='修改密码', command=self.updatepwdData2)
|
||||
menubar.add_cascade(label='主页', menu=menu1)
|
||||
# menubar.add_command(label='主页', command=self.inputData)
|
||||
menubar.add_command(label='查询成绩', command=self.queryData)
|
||||
menubar.add_command(label='意见反馈', command=self.countData)
|
||||
menubar.add_command(label='提交作业', command=self.submitData)
|
||||
menubar.add_command(label= "学生"+self.usrname + '已登录,退出登录', command=self.returnLogin)
|
||||
self.root['menu'] = menubar # 设置菜单栏
|
||||
|
||||
def updatepwdData2(self):
|
||||
self.updatepwdPage2.pack()
|
||||
self.inputPage.pack_forget()
|
||||
self.queryPage.pack_forget()
|
||||
self.countPage.pack_forget()
|
||||
self.submitPage.pack_forget()
|
||||
self.myPage2.pack_forget()
|
||||
|
||||
def myData2(self):
|
||||
self.myPage2.pack()
|
||||
self.queryPage.pack_forget()
|
||||
self.countPage.pack_forget()
|
||||
self.submitPage.pack_forget()
|
||||
self.inputPage.pack_forget()
|
||||
self.updatepwdPage2.pack_forget()
|
||||
|
||||
def inputData(self):
|
||||
self.inputPage.pack()
|
||||
self.queryPage.pack_forget()
|
||||
self.countPage.pack_forget()
|
||||
self.submitPage.pack_forget()
|
||||
self.myPage2.pack_forget()
|
||||
self.updatepwdPage2.pack_forget()
|
||||
|
||||
def queryData(self):
|
||||
self.inputPage.pack_forget()
|
||||
self.queryPage.pack()
|
||||
self.countPage.pack_forget()
|
||||
self.submitPage.pack_forget()
|
||||
self.myPage2.pack_forget()
|
||||
self.updatepwdPage2.pack_forget()
|
||||
|
||||
def countData(self):
|
||||
self.inputPage.pack_forget()
|
||||
self.queryPage.pack_forget()
|
||||
self.submitPage.pack_forget()
|
||||
self.countPage.pack()
|
||||
self.myPage2.pack_forget()
|
||||
self.updatepwdPage2.pack_forget()
|
||||
|
||||
def submitData(self):
|
||||
self.inputPage.pack_forget()
|
||||
self.queryPage.pack_forget()
|
||||
self.countPage.pack_forget()
|
||||
self.submitPage.pack()
|
||||
self.myPage2.pack_forget()
|
||||
self.updatepwdPage2.pack_forget()
|
||||
|
||||
def aboutDisp(self):
|
||||
self.inputPage.pack_forget()
|
||||
self.queryPage.pack_forget()
|
||||
self.countPage.pack_forget()
|
||||
self.submitPage.pack_forget()
|
||||
self.myPage2.pack_forget()
|
||||
self.updatepwdPage2.pack_forget()
|
||||
|
||||
def returnLogin(self):
|
||||
self.myPage2.destroy()
|
||||
self.updatepwdPage2.destroy()
|
||||
self.inputPage.destroy()
|
||||
self.queryPage.destroy()
|
||||
self.countPage.destroy()
|
||||
self.submitPage.destroy()
|
||||
self.menubar.destroy()
|
||||
LoginPage(self.root)
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -0,0 +1,4 @@
|
||||
1.课好多
|
||||
2.作业好多
|
||||
3.不想上学
|
||||
4.好多作业呀
|
@ -0,0 +1 @@
|
||||
Subproject commit 4d94f463fc3cd8bd89bdbee7eb7181e3e5a56fa9
|
Loading…
Reference in new issue