【Python + Mysql + UI】学生信息管理系统(附代码)
...........做了一个学生信息管理的简单数据库程序,写了一点简单的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.messageboxpage = 0
who = 0def admin_func():passdef button_login_clicked():pass
def lb1(*args):indexs = listbox1.curselection()print(indexs)if(len(indexs) == 0):return Noneindex = int(indexs[0]);print(123123123123)def button2_clicked():global whowho = 1page = 0display_current_page()data_in = Nonedef display(i,data):global data_indata_in = datalistbox1.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, whopage+= 1if 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, whopage -= 1page = 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, whopage = pageif 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, pagewho = 0page = 0display_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 = -1if 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 Noneadd_id = entry4.get().strip()if len(add_id)<=0:tkinter.messagebox.showerror("Error","请输入编号")return Nonetry:add_id = int(add_id)except Exception as e:tkinter.messagebox.showerror("Error","输入编号错误")return Noneadd_name = entry5.get().strip()if len(add_name)<=0:tkinter.messagebox.showerror("Error","请输入名字")return Noneadd_gender = combobox_3.current()if add_gender < 0:tkinter.messagebox.showerror("Error","请选择性别")return Noneadd_age = entry7.get().strip()if len(add_age)<=0:tkinter.messagebox.showerror("Error","请输入年龄")return Nonetry:add_age = int(add_age)except Exception as e:tkinter.messagebox.showerror("Error","年龄输入错误")return Noneadd_grade = entry7.get().strip()if len(add_grade)<=0:tkinter.messagebox.showerror("Error","请输入年级")return Nonetry: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 Nonecursor.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 Nonecursor.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.messageboxdatabase = 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 modeindex = 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 = 0else: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 = 1else: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 = 2else: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 = -1if 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 Nonecursor.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 Nonecursor.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 Nonecursor.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 Nonecursor.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 Nonecursor.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 Nonecursor.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 Noneif len(content) == 0:tkinter.messagebox.showerror("错误","请输入搜索内容")return Noneif index == 0:try:search_id = int(content)except Exception as e:tkinter.messagebox.showerror("Error","请输入正确id")return Nonecursor.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 Nonecursor.execute("select * from student_info where id = %d" % content)data = cursor.fetchall()if len(data) == 0:tkinter.messagebox.showerror("Error","学号不存在") return Nonetkinter.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 = 0who = 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 = 0who = 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()
【Python + Mysql + UI】学生信息管理系统(附代码)相关推荐
- python输入学生姓名_python学生信息管理系统实现代码
1.本人第一次学python做出来的,当时满满的成就感,当作纪念!!!!! 非常简单,复制即可使用 代码块 import json#把字符串类型的数据转换成Python基本数据类型或者将Python基 ...
- [Python+Django]Web学生信息管理系统数据库设计及系统实现
本文我们完成数据的设计,并通过Django框架完成数据库构建同时利用Django框架模式实现学生信息管理系统的功能. 简单的包装下毕设应该没问题了. Python,Mysql,Pycharm的安装本文 ...
- python学生管理系统界面-Python实现GUI学生信息管理系统
本文实例为大家分享了Python实现GUI学生信息管理系统的具体代码,供大家参考,具体内容如下 项目环境: 软件环境: OS:RedHat6.3 Lib:Pygtk Language:Python S ...
- Eclipse+Java+Swing+Mysql实现学生信息管理系统
目录 一.系统介绍 1.开发环境 2.技术选型 3.系统功能 4.数据库 二.系统展示 1.注册系统 2.登录系统 3.系统主页面 4.添加学生信息 5.修改学生信息 6.查询学生信息 三.部分代码 ...
- 信息管理系统 github_Java+MySQL实现学生信息管理系统
基于Java swing+MySQL实现学生信息管理系统:主要实现JDBC对学生信息进行增删改查,应付一般课设足矣,分享给大家. 源码: https://github.com/ZhuangM/stud ...
- Python制作基础学生信息管理系统
本文详细讲解了Python制作基础学生信息管理系统的实现,对大家的学习或者工作具有一定的参考学习价值,需要的朋友们下面随着小编来一起学习学习吧.编程资料领取 目录 一.前言 二.开发环境: 三.涉及知 ...
- 基于PHP+MySQL的学生信息管理系统(源码)
项目名称:基于PHP+MySQL的学生信息管理系统 本系统是一个用于管理学生信息的管理系统,包括基本的增删改查,系统使用PHP语言开发,使用MySQL数据库,可以供初学者参考使用. 系统环境 MySQ ...
- Python题目:学生信息管理系统
Python题目:学生信息管理系统 选用list.tuple.dictionary或map等数据结构,存储X个学生的三门课的成绩(机器学习.Python程序设计.研究生英语),并实现以下 ...
- python项目:学生信息管理系统(初版)
python项目:学生信息管理系统(初版) 学生信息管理项目,要求带操作界面,并完成每项操作: +----------------------+ | 1)添加学生信息 | | 2)显示所有学生的信息 ...
- 基于python 使用tk模块和mysql实现学生信息管理系统
学生信息管理系统 好久没有发文啦,经过一段时间的学习,有所收获,写了个小项目,记录一下学习过程.好啦,废话不多说,我们直接说实现,看效果. 首先系统是有三个视图,一个管理员,一个教师,一个学生,运行效 ...
最新文章
- 计算机兴趣小组活动实施方式,信息技术兴趣小组活动计划
- Ehab and a 2-operation task
- 挖洞技巧:如何绕过URL限制
- 《计算机导论》课程论文,计算机导论课程论文
- 能量采集(HYSBZ-2005)
- 病毒周报(100118至100124)
- hive函数进阶总结
- dedecms 文章列表被加粗的加爵办法
- 校验、加密、压缩、哈希值的区别,我老是弄混,现在总结一下
- AngularJS学习笔记-2
- Windows Terminal 快速安装
- 阿里云虚拟主机wordpress伪静态设置Nginx设置
- win10系统CMD窗口MySQL5.6中文乱码问题
- springboot集成hadoop实战
- 计算机一级b选择题相关知识点,一级B辅导资料(选择题知识点)
- 基于java码头船只出行及配套货柜码放管理系统(含源文件)
- Filament 渲染引擎简介
- 学生免费领取阿里云ECS云服务器并使用全过程(部署个人博客项目)
- 1)前端的html和css基础标签简单盒子
- webservice 教程学习系列(七)——编写天气预报和手机号码归属地的webservice