...........做了一个学生信息管理的简单数据库程序,写了一点简单的UI界面,功能不是很强大,代码组织也很不科学,洋洋洒洒竟然写了700多行.......分享出来,一起学习
/**********************************
@ author: CSDN @WilliamCode
@ E-mail: 1327804001@qq.com
@ date: 2019-01-09
@ All Rights Reserved
@
@专业程序员,精通C,Python,Java,mysql数据库,python前端与后端开发
@欢迎各位朋友提出建议一起进步
@
@承接web前端外包,微信小程序外包,单片机相关外包,价格实惠,代码质量保证,欢迎联系
@邮箱1327804001@qq.com
@微信xiechunhao12138
**********************************/
创建数据库代码如下:
create database student_info_system;
use student_info_system
create table admin(username char(30),password char(30));
insert into admin values('admin','admin');
create table teacher_up(username char(30),password char(30));
create table student_up(username char(30), password char(30));
insert into teacher_up values('admin','admin');
insert into student_upvalues('admin','admin');
create table teacher_info(id bigint primary key,name char(10),gender char(2),age int,grade int);
create table student_info(id bigint primary key,name char(30),gender char(2),age int,grade int);
其中teacher_up(teacher username & password)存放老师账户的用户名和密码,其他up结尾的同样。以_info为结尾的表存放老师或者学生信息。先给管理员账户添加了初始账户和密码(admin,admin)
然后是代码,需要先安装pymysql库,安装命令pip3 install pymysql
下面是带UI的学生信息管理代码,在Python3.6下调试通过。
'''______________________________________-admin_______________________________________'''
from tkinter import *
from tkinter import ttk
import tkinter.messagebox
page = 0
who = 0
def admin_func():
pass
def button_login_clicked():
pass
def lb1(*args):
indexs = listbox1.curselection()
print(indexs)
if(len(indexs) == 0):
return None
index = int(indexs[0]);
print(123123123123)
def button2_clicked():
global who
who = 1
page = 0
display_current_page()
data_in = None
def display(i,data):
global data_in
data_in = data
listbox1.delete(0,END)
listbox2.delete(0,END)
listbox3.delete(0,END)
listbox4.delete(0,END)
listbox5.delete(0,END)
listbox6.delete(0,END)
for d in data:
if i==1:
listbox1.insert(END,'学生')
else:
listbox1.insert(END,'老师')
listbox2.insert(END, d[0])
listbox3.insert(END, d[1])
listbox4.insert(END, d[2])
listbox5.insert(END, d[3])
listbox6.insert(END, d[4])
def display_next_page():
global page, who
page+= 1
if who == 1:
cursor.execute("select * from student_info limit %d,%d" % (page*20, page*20+20))
data = cursor.fetchall()
display(who, data)
else:
cursor.execute("select * from teacher_info limit %d,%d" % (page*20, page*20+20))
data = cursor.fetchall()
display(who, data)
def button_next_page_clicked():
display_next_page()
def display_previous_page():
global page, who
page -= 1
page = max(page, 0)
if who == 1:
cursor.execute("select * from student_info limit %d,%d" % (page*20, page*20+20))
data = cursor.fetchall()
display(who, data)
else:
cursor.execute("select * from teacher_info limit %d,%d" % (page*20, page*20+20))
data = cursor.fetchall()
display(who, data)
def display_current_page():
global page, who
page = page
if who == 1:
cursor.execute("select * from student_info limit %d,%d" % (page*20, page*20+20))
data = cursor.fetchall()
display(who, data)
else:
cursor.execute("select * from teacher_info limit %d,%d" % (page*20, page*20+20))
data = cursor.fetchall()
display(who, data)
def button_teacher_clicked():
global who, page
who = 0
page = 0
display_current_page()
def button_delete_clicked():
indexs1 = listbox1.curselection()
indexs2 = listbox2.curselection()
indexs3 = listbox3.curselection()
indexs4 = listbox4.curselection()
indexs5 = listbox5.curselection()
indexs6 = listbox6.curselection()
index = -1
if len(indexs1) > 0:
index = indexs1[0]
elif len(indexs2) > 0:
index = indexs2[0]
elif len(indexs3) > 0:
index = indexs3[0]
elif len(indexs4) > 0:
index = indexs4[0]
elif len(indexs5) > 0:
index = indexs5[0]
elif len(indexs6) > 0:
index = indexs6[0]
if index == -1:
tkinter.messagebox.showerror("Error","未选择要删除的数据")
delete_id = listbox2.get(index,index)
delete_who = listbox1.get(index,index)
if delete_who[0] == "学生":
cursor.execute("delete from student_info where id = %d" % int(delete_id[0]))
print("delete from student_info where id = %d" % int(delete_id[0]))
database.commit()
display_current_page()
else:
cursor.execute("delete from teacher_info where id = %d" % int(delete_id[0]))
database.commit()
display_current_page()
#print(delete_id)
'''
combobox_ =2ttk.Combobox(myWindow, values = ['学生','教师'], width=17)
combobox_2.grid(column = 0, row = 5)
entry4=Entry(myWindow)
entry4.grid(column = 1, row = 5)
entry5=Entry(myWindow)
entry5.grid(column = 2, row = 5)
combobox_3 = ttk.Combobox(myWindow, values = ['男','女'], width=17)
combobox_3.grid(column = 3, row = 5)
entry7=Entry(myWindow)
entry7.grid(column = 4, row = 5)
entry8=Entry(myWindow)
entry8.grid(column = 5, row = 5)'''
def button_add_clicked():
index = combobox_2.current()
if index < 0:
tkinter.messagebox.showerror("Error","请选择身份")
return None
add_id = entry4.get().strip()
if len(add_id)<=0:
tkinter.messagebox.showerror("Error","请输入编号")
return None
try:
add_id = int(add_id)
except Exception as e:
tkinter.messagebox.showerror("Error","输入编号错误")
return None
add_name = entry5.get().strip()
if len(add_name)<=0:
tkinter.messagebox.showerror("Error","请输入名字")
return None
add_gender = combobox_3.current()
if add_gender < 0:
tkinter.messagebox.showerror("Error","请选择性别")
return None
add_age = entry7.get().strip()
if len(add_age)<=0:
tkinter.messagebox.showerror("Error","请输入年龄")
return None
try:
add_age = int(add_age)
except Exception as e:
tkinter.messagebox.showerror("Error","年龄输入错误")
return None
add_grade = entry7.get().strip()
if len(add_grade)<=0:
tkinter.messagebox.showerror("Error","请输入年级")
return None
try:
add_grade = int(add_grade)
except Exception as e:
tkinter.messagebox.showerror("Error","输入年级错误")
return None
#print(index, add_id, add_name,add_gender,add_age,add_grade)
if index == 0:
cursor.execute('select * from student_info where id = %d' % add_id)
data = cursor.fetchall()
if len(data) > 0:
tkinter.messagebox.showerror("Error","Existed id")
return None
cursor.execute('insert into student_info value(%d,"%s","%s",%d,%d)' % (add_id, add_name, "男" if add_gender == 0 else "女", add_age, add_grade))
database.commit()
display_current_page()
else:
cursor.execute('select * from teacher_info where id = %d' % add_id)
data = cursor.fetchall()
if len(data) > 0:
tkinter.messagebox.showerror("Error","Existed id")
return None
cursor.execute('insert into teacher_info value(%d,"%s","%s",%d,%d)' % (add_id, add_name, "男" if add_gender == 0 else "女", add_age, add_grade))
database.commit()
display_current_page()
'''______________________________________-admin_______________________________________'''
import pymysql
from tkinter import *
from tkinter import ttk
import tkinter.messagebox
database = pymysql.connect('localhost', 'root', '', charset='utf8', port = 3306)
cursor = database.cursor()
if database.open == False:
raise Exception("数据库未连接,请检查数据库服务是否启动")
cursor.execute('use student_info_system')
'''
id` bigint(20) NOT NULL,
`name` char(30) DEFAULT NULL,
`gender` char(2) DEFAULT NULL,
`age` int(11) DEFAULT NULL,
`grade` int(11) DEFAULT NULL,
PRIMARY KEY (`id`)'''
mode = -1
def button_login_clicked():
global mode
index = combobox_login.current()
username_input = entry1.get().strip()
password_input = entry2.get().strip()
print(index, username_input, password_input)
if index == -1:
tkinter.messagebox.showerror("错误","请选择你的登陆身份")
elif len(username_input) == 0 or len(password_input) == 0:
tkinter.messagebox.showerror("错误","请输入用户名和密码")
else:
if index == 0:
cursor.execute('select * from admin where username = "%s" and password = "%s"' % (username_input,password_input))
if (len(cursor.fetchall()) > 0):
print("pass")
myWindow.destroy()
mode = 0
else:
tkinter.messagebox.showerror("错误","用户名或密码错误")
if index == 1:
cursor.execute('select * from teacher_up where username = "%s" and password = "%s"' % (username_input,password_input))
if (len(cursor.fetchall()) > 0):
print("pass")
myWindow.destroy()
mode = 1
else:
tkinter.messagebox.showerror("错误","用户名或密码错误")
if index == 2:
cursor.execute('select * from student_up where username = "%s" and password = "%s"' % (username_input,password_input))
if (len(cursor.fetchall()) > 0):
print("pass")
myWindow.destroy()
mode = 2
else:
tkinter.messagebox.showerror("错误","用户名或密码错误")
'''
Label(myWindow, text='身份无法修改',font=('Arial 12 bold'),width=10,height=1).grid(column = 0, row = 4)
Label(myWindow, text='编号无法修改',font=('Arial 12 bold'),width=10,height=1).grid(column = 1, row = 4)
entry11=Entry(myWindow)
entry11.grid(column = 2, row = 4)
combobox_22 = ttk.Combobox(myWindow, values = ['男','女'], width=17)
combobox_22.grid(column = 3, row = 4)
entry22=Entry(myWindow)
entry22.grid(column = 4, row = 4)
entry33=Entry(myWindow)
entry33.grid(column = 5, row = 4)
button4 = Button(text = '修改',relief = 'raised', command = button_change_clicked)
button4.grid(column = 6, row = 4)
'''
def button_change_clicked():
indexs1 = listbox1.curselection()
indexs2 = listbox2.curselection()
indexs3 = listbox3.curselection()
indexs4 = listbox4.curselection()
indexs5 = listbox5.curselection()
indexs6 = listbox6.curselection()
print(indexs1,indexs2,indexs3,indexs4,indexs5,indexs6)
index = -1
if len(indexs1) > 0:
index = indexs1[0]
elif len(indexs2) > 0:
index = indexs2[0]
elif len(indexs3) > 0:
index = indexs3[0]
elif len(indexs4) > 0:
index = indexs4[0]
elif len(indexs5) > 0:
index = indexs5[0]
elif len(indexs6) > 0:
index = indexs6[0]
if index == -1:
tkinter.messagebox.showerror("错误","请选择要修改的数据")
change_id = listbox2.get(index,index)[0]
change_who = listbox1.get(index,index)[0]
change_name = entry11.get().strip()
change_age = entry22.get().strip()
change_grade = entry33.get().strip()
index = combobox_22.current()
if len(change_name) > 0:
if (change_who == "学生"):
try:
change_id = int(change_id)
except Exception as e:
tkinter.messagebox.showerror("错误","输入错误")
return None
cursor.execute('update student_info set name = "%s" where id = %d' % (change_name, change_id))
database.commit()
display_current_page()
else:
try:
change_id = int(change_id)
except Exception as e:
tkinter.messagebox.showerror("错误","输入错误")
return None
cursor.execute('update teacher_info set name = "%s" where id = %d' % (change_name, change_id))
database.commit()
display_current_page()
if len(change_age) > 0:
if (change_who == "学生"):
try:
change_age = int(change_age)
except Exception as e:
tkinter.messagebox.showerror("错误","输入错误")
return None
cursor.execute('update student_info set age = "%s" where id = %d' % (int(change_age), int(change_id)))
database.commit()
display_current_page()
else:
try:
change_age = int(change_age)
except Exception as e:
tkinter.messagebox.showerror("错误","输入错误")
return None
cursor.execute('update teacher_info set age = "%s" where id = %d' % (int(change_age), int(change_id)))
database.commit()
display_current_page()
if len(change_grade) > 0:
if (change_who == "学生"):
try:
change_grade = int(change_grade)
except Exception as e:
tkinter.messagebox.showerror("错误","输入错误")
return None
cursor.execute('update student_info set grade = "%s" where id = %d' % (int(change_grade), int(change_id)))
database.commit()
display_current_page()
else:
try:
change_grade = int(change_grade)
except Exception as e:
tkinter.messagebox.showerror("错误","输入错误")
return None
cursor.execute('update teacher_info set grade = "%s" where id = %d' % (int(change_grade), int(change_id)))
database.commit()
display_current_page()
if index != -1:
if (change_who == "学生"):
cursor.execute('update student_info set gender = "%s" where id = %d' % ("男" if index==0 else "女", int(change_id)))
database.commit()
display_current_page()
else:
cursor.execute('update teacher_info set gender = "%s" where id = %d' % ("男" if index==0 else "女", int(change_id)))
database.commit()
display_current_page()
'''
Label(myWindow, text="搜索选项:",font=('Arial 12 bold'),width=10,height=1).grid(column = 0, row = 0)
combobox_1 = ttk.Combobox(myWindow, values = ['按编号搜索','按姓名搜索'], width=17)
combobox_1.grid(column = 1, row = 0)
Label(myWindow, text="搜索关键字:",font=('Arial 12 bold'),width=10,height=1).grid(column = 2, row = 0)
entry1=Entry(myWindow)
entry1.grid(column = 3, row = 0)
button1 = Button(text = '搜索',relief = 'raised', command = button_search_clicked)
button1.grid(column = 4, row = 0)
'''
def button_search_clicked():
index = combobox_1.current()
content = entry1.get().strip()
if index == -1:
tkinter.messagebox.showerror("错误","请选择搜索依据")
return None
if len(content) == 0:
tkinter.messagebox.showerror("错误","请输入搜索内容")
return None
if index == 0:
try:
search_id = int(content)
except Exception as e:
tkinter.messagebox.showerror("Error","请输入正确id")
return None
cursor.execute('select * from student_info where id = %d' % search_id)
data1 = cursor.fetchall()
cursor.execute('select * from teacher_info where id = %d' % search_id)
data2 = cursor.fetchall()
listbox1.delete(0,END)
listbox2.delete(0,END)
listbox3.delete(0,END)
listbox4.delete(0,END)
listbox5.delete(0,END)
listbox6.delete(0,END)
for d in data1:
listbox1.insert(END,'学生')
listbox2.insert(END, d[0])
listbox3.insert(END, d[1])
listbox4.insert(END, d[2])
listbox5.insert(END, d[3])
listbox6.insert(END, d[4])
for d in data2:
listbox1.insert(END,'老师')
listbox2.insert(END, d[0])
listbox3.insert(END, d[1])
listbox4.insert(END, d[2])
listbox5.insert(END, d[3])
listbox6.insert(END, d[4])
if index == 1:
cursor.execute('select * from student_info where name = "%s"' % content)
data1 = cursor.fetchall()
cursor.execute('select * from teacher_info where name = "%s"' % content)
data2 = cursor.fetchall()
listbox1.delete(0,END)
listbox2.delete(0,END)
listbox3.delete(0,END)
listbox4.delete(0,END)
listbox5.delete(0,END)
listbox6.delete(0,END)
for d in data1:
listbox1.insert(END,'学生')
listbox2.insert(END, d[0])
listbox3.insert(END, d[1])
listbox4.insert(END, d[2])
listbox5.insert(END, d[3])
listbox6.insert(END, d[4])
for d in data2:
listbox1.insert(END,'老师')
listbox2.insert(END, d[0])
listbox3.insert(END, d[1])
listbox4.insert(END, d[2])
listbox5.insert(END, d[3])
listbox6.insert(END, d[4])
#初始化Tk()
myWindow = Tk()
#设置标题
myWindow.title('学生信息管理系统登陆')
myWindow.geometry('360x240')
#创建一个标签,显示文本
Label(myWindow, text="用户名:",font=('Arial 12 bold'),width=10,height=1).place(relx = 0.10, rely = 0.3)
Label(myWindow, text="密码:",font=('Arial 12 bold'),width=10,height=1).place(relx = 0.10, rely = 0.5)
Label(myWindow, text="登陆身份:",font=('Arial 12 bold'),width=10,height=1).place(relx = 0.10, rely = 0.1)
combobox_login = ttk.Combobox(myWindow, values = ['管理员','教师','学生'], width=17)
combobox_login.place(relx = 0.45, rely = 0.1)
button_login = Button(text = '登陆',relief = 'raised', command = button_login_clicked)
button_login.place(relx = 0.5, rely = 0.7)
entry1=Entry(myWindow)
entry2=Entry(myWindow)
entry1.place(relx = 0.45, rely = 0.3)
entry2.place(relx = 0.45, rely = 0.5)
#进入消息循环
myWindow.mainloop()
'''
myWindow = Tk()
#设置标题
myWindow.title('学生界面')
myWindow.geometry('1280x640')
Label(myWindow, text='输入学号查询信息',font=('Arial 12 bold'),width=10,height=1).grid(column = 0, row = 0)
entry111=Entry(myWindow)
entry111.grid(column = 1, row = 0)
button111 = Button(text = '查询',relief = 'raised', command = Student_click)
button111.grid(column = 2, row = 0)
'''
def Student_click():
content = entry111.get()
if len(content) == 0:
tkinter.messagebox.showerror("Error","请输入学号")
try:
content = int(content)
except Exception as e:
tkinter.messagebox.showerror("Error","请输入正确学号")
return None
cursor.execute("select * from student_info where id = %d" % content)
data = cursor.fetchall()
if len(data) == 0:
tkinter.messagebox.showerror("Error","学号不存在")
return None
tkinter.messagebox.showinfo("学生信息","学号:%d\n姓名:%s\n性别:%s\n年龄:%d\n年级:%d" % (
data[0][0], data[0][1], data[0][2], data[0][3], data[0][4]))
if mode == 0:
print("asdasd")
page = 0
who = 1
#初始化Tk()
myWindow = Tk()
#设置标题
myWindow.title('管理员界面')
myWindow.geometry('1280x640')
#创建一个标签,显示文本
Label(myWindow, text="搜索选项:",font=('Arial 12 bold'),width=10,height=1).grid(column = 0, row = 0)
combobox_1 = ttk.Combobox(myWindow, values = ['按编号搜索','按姓名搜索'], width=17)
combobox_1.grid(column = 1, row = 0)
Label(myWindow, text="搜索关键字:",font=('Arial 12 bold'),width=10,height=1).grid(column = 2, row = 0)
entry1=Entry(myWindow)
entry1.grid(column = 3, row = 0)
button1 = Button(text = '搜索',relief = 'raised', command = button_search_clicked)
button1.grid(column = 4, row = 0)
button2 = Button(text = '显示所有学生信息',relief = 'raised', command = button2_clicked)
button2.grid(column = 5, row = 0)
button3 = Button(text = '显示所有教师信息',relief = 'raised', command = button_teacher_clicked)
button3.grid(column = 6, row = 0)
Label(myWindow, text=" ",font=('Arial 12 bold'),width=4,height=1).grid(column = 0, row = 1)
Label(myWindow, text="身份",font=('Arial 12 bold'),width=10,height=1).grid(column = 0, row = 2)
listbox1 = Listbox(myWindow,height=20,selectmode="browse",font=('Arial 12 bold'))
listbox1.grid(column = 0, row = 3)
Label(myWindow, text="编号",font=('Arial 12 bold'),width=10,height=1).grid(column = 1, row = 2)
listbox2 = Listbox(myWindow,height=20,selectmode="browse",font=('Arial 12 bold'))
listbox2.grid(column = 1, row = 3)
Label(myWindow, text="姓名",font=('Arial 12 bold'),width=10,height=1).grid(column = 2, row = 2)
listbox3 = Listbox(myWindow,height=20,width = 10,selectmode="browse",font=('Arial 12 bold'))
listbox3.grid(column = 2, row = 3)
Label(myWindow, text="性别",font=('Arial 12 bold'),width=10,height=1).grid(column = 3, row = 2)
listbox4 = Listbox(myWindow,height=20,width = 5,selectmode="browse",font=('Arial 12 bold'))
listbox4.grid(column = 3, row = 3)
Label(myWindow, text="年龄",font=('Arial 12 bold'),width=10,height=1).grid(column = 4, row = 2)
listbox5 = Listbox(myWindow,height=20,width = 8,selectmode="browse",font=('Arial 12 bold'))
listbox5.grid(column = 4, row = 3)
Label(myWindow, text="年级",font=('Arial 12 bold'),width=10,height=1).grid(column = 5, row = 2)
listbox6 = Listbox(myWindow,height=20,width = 8,selectmode="browse",font=('Arial 12 bold'))
listbox6.grid(column = 5, row = 3)
Label(myWindow, text='身份无法修改',font=('Arial 12 bold'),width=10,height=1).grid(column = 0, row = 4)
Label(myWindow, text='编号无法修改',font=('Arial 12 bold'),width=10,height=1).grid(column = 1, row = 4)
entry11=Entry(myWindow)
entry11.grid(column = 2, row = 4)
combobox_22 = ttk.Combobox(myWindow, values = ['男','女'], width=17)
combobox_22.grid(column = 3, row = 4)
entry22=Entry(myWindow)
entry22.grid(column = 4, row = 4)
entry33=Entry(myWindow)
entry33.grid(column = 5, row = 4)
button4 = Button(text = '修改',relief = 'raised', command = button_change_clicked)
button4.grid(column = 6, row = 4)
combobox_2 = ttk.Combobox(myWindow, values = ['学生','教师'], width=17)
combobox_2.grid(column = 0, row = 5)
entry4=Entry(myWindow)
entry4.grid(column = 1, row = 5)
entry5=Entry(myWindow)
entry5.grid(column = 2, row = 5)
combobox_3 = ttk.Combobox(myWindow, values = ['男','女'], width=17)
combobox_3.grid(column = 3, row = 5)
entry7=Entry(myWindow)
entry7.grid(column = 4, row = 5)
entry8=Entry(myWindow)
entry8.grid(column = 5, row = 5)
button5 = Button(text = '添加',relief = 'raised', command = button_add_clicked)
button5.grid(column = 6, row = 5)
button6 = Button(text = '删除',relief = 'raised', command = button_delete_clicked)
button6.grid(column = 6, row = 6)
button7 = Button(text = '上一页',relief = 'raised', command = display_previous_page)
button7.grid(column = 3, row = 7)
button8 = Button(text = '下一页',relief = 'raised', command = button_next_page_clicked)
button8.grid(column = 4, row = 7)
#进入消息循环
myWindow.mainloop()
elif mode == 1:
print("asdasd")
page = 0
who = 1
#初始化Tk()
myWindow = Tk()
#设置标题
myWindow.title('教师界面')
myWindow.geometry('1280x640')
#创建一个标签,显示文本
Label(myWindow, text="搜索选项:",font=('Arial 12 bold'),width=10,height=1).grid(column = 0, row = 0)
combobox_1 = ttk.Combobox(myWindow, values = ['按编号搜索','按姓名搜索'], width=17)
combobox_1.grid(column = 1, row = 0)
Label(myWindow, text="搜索关键字:",font=('Arial 12 bold'),width=10,height=1).grid(column = 2, row = 0)
entry1=Entry(myWindow)
entry1.grid(column = 3, row = 0)
button1 = Button(text = '搜索',relief = 'raised', command = button_search_clicked)
button1.grid(column = 4, row = 0)
button2 = Button(text = '显示所有学生信息',relief = 'raised', command = button2_clicked)
button2.grid(column = 5, row = 0)
Label(myWindow, text=" ",font=('Arial 12 bold'),width=4,height=1).grid(column = 0, row = 1)
Label(myWindow, text="身份",font=('Arial 12 bold'),width=10,height=1).grid(column = 0, row = 2)
listbox1 = Listbox(myWindow,height=20,selectmode="browse",font=('Arial 12 bold'))
listbox1.grid(column = 0, row = 3)
Label(myWindow, text="编号",font=('Arial 12 bold'),width=10,height=1).grid(column = 1, row = 2)
listbox2 = Listbox(myWindow,height=20,selectmode="browse",font=('Arial 12 bold'))
listbox2.grid(column = 1, row = 3)
Label(myWindow, text="姓名",font=('Arial 12 bold'),width=10,height=1).grid(column = 2, row = 2)
listbox3 = Listbox(myWindow,height=20,width = 10,selectmode="browse",font=('Arial 12 bold'))
listbox3.grid(column = 2, row = 3)
Label(myWindow, text="性别",font=('Arial 12 bold'),width=10,height=1).grid(column = 3, row = 2)
listbox4 = Listbox(myWindow,height=20,width = 5,selectmode="browse",font=('Arial 12 bold'))
listbox4.grid(column = 3, row = 3)
Label(myWindow, text="年龄",font=('Arial 12 bold'),width=10,height=1).grid(column = 4, row = 2)
listbox5 = Listbox(myWindow,height=20,width = 8,selectmode="browse",font=('Arial 12 bold'))
listbox5.grid(column = 4, row = 3)
Label(myWindow, text="年级",font=('Arial 12 bold'),width=10,height=1).grid(column = 5, row = 2)
listbox6 = Listbox(myWindow,height=20,width = 8,selectmode="browse",font=('Arial 12 bold'))
listbox6.grid(column = 5, row = 3)
Label(myWindow, text='身份无法修改',font=('Arial 12 bold'),width=10,height=1).grid(column = 0, row = 4)
Label(myWindow, text='编号无法修改',font=('Arial 12 bold'),width=10,height=1).grid(column = 1, row = 4)
entry11=Entry(myWindow)
entry11.grid(column = 2, row = 4)
combobox_22 = ttk.Combobox(myWindow, values = ['男','女'], width=17)
combobox_22.grid(column = 3, row = 4)
entry22=Entry(myWindow)
entry22.grid(column = 4, row = 4)
entry33=Entry(myWindow)
entry33.grid(column = 5, row = 4)
button4 = Button(text = '修改',relief = 'raised', command = button_change_clicked)
button4.grid(column = 6, row = 4)
combobox_2 = ttk.Combobox(myWindow, values = ['学生'], width=17)
combobox_2.grid(column = 0, row = 5)
entry4=Entry(myWindow)
entry4.grid(column = 1, row = 5)
entry5=Entry(myWindow)
entry5.grid(column = 2, row = 5)
combobox_3 = ttk.Combobox(myWindow, values = ['男','女'], width=17)
combobox_3.grid(column = 3, row = 5)
entry7=Entry(myWindow)
entry7.grid(column = 4, row = 5)
entry8=Entry(myWindow)
entry8.grid(column = 5, row = 5)
button5 = Button(text = '添加',relief = 'raised', command = button_add_clicked)
button5.grid(column = 6, row = 5)
button6 = Button(text = '删除',relief = 'raised', command = button_delete_clicked)
button6.grid(column = 6, row = 6)
button7 = Button(text = '上一页',relief = 'raised', command = display_previous_page)
button7.grid(column = 3, row = 7)
button8 = Button(text = '下一页',relief = 'raised', command = button_next_page_clicked)
button8.grid(column = 4, row = 7)
#进入消息循环
myWindow.mainloop()
elif mode == 2:
myWindow = Tk()
#设置标题
myWindow.title('学生界面')
myWindow.geometry('1280x640')
Label(myWindow, text='输入学号查询信息',font=('Arial 12 bold'),height=1).grid(column = 0, row = 0)
entry111=Entry(myWindow)
entry111.grid(column = 1, row = 0)
button111 = Button(text = '查询',relief = 'raised', command = Student_click)
button111.grid(column = 2, row = 0)
myWindow.mainloop()