亚洲免费在线-亚洲免费在线播放-亚洲免费在线观看-亚洲免费在线观看视频-亚洲免费在线看-亚洲免费在线视频

【Python + Mysql + UI】學(xué)生信息管理系統(tǒng)(附代碼)

系統(tǒng) 1950 0

...........做了一個(gè)學(xué)生信息管理的簡單數(shù)據(jù)庫程序,寫了一點(diǎn)簡單的UI界面,功能不是很強(qiáng)大,代碼組織也很不科學(xué),洋洋灑灑竟然寫了700多行.......分享出來,一起學(xué)習(xí)

/**********************************
@ author:????CSDN @WilliamCode
@ E-mail:????1327804001@qq.com
@ date:????????2019-01-09
@ All Rights Reserved
@
@專業(yè)程序員,精通C,Python,Java,mysql數(shù)據(jù)庫,python前端與后端開發(fā)
@歡迎各位朋友提出建議一起進(jìn)步
@
@承接web前端外包,微信小程序外包,單片機(jī)相關(guān)外包,價(jià)格實(shí)惠,代碼質(zhì)量保證,歡迎聯(lián)系
@郵箱1327804001@qq.com
@微信xiechunhao12138
**********************************/
?

創(chuàng)建數(shù)據(jù)庫代碼如下:

            
              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結(jié)尾的同樣。以_info為結(jié)尾的表存放老師或者學(xué)生信息。先給管理員賬戶添加了初始賬戶和密碼(admin,admin)

?

然后是代碼,需要先安裝pymysql庫,安裝命令pip3 install pymysql

下面是帶UI的學(xué)生信息管理代碼,在Python3.6下調(diào)試通過。

            
              
'''______________________________________-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,'學(xué)生')
		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","未選擇要?jiǎng)h除的數(shù)據(jù)")

	delete_id = listbox2.get(index,index)
	delete_who = listbox1.get(index,index)
	if delete_who[0] == "學(xué)生":
		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 = ['學(xué)生','教師'], 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","請(qǐng)選擇身份")
		return None
	
	add_id = entry4.get().strip()
	if len(add_id)<=0:
		tkinter.messagebox.showerror("Error","請(qǐng)輸入編號(hào)")
		return None
	try:
		add_id = int(add_id)
	except Exception as e:
		tkinter.messagebox.showerror("Error","輸入編號(hào)錯(cuò)誤")
		return None

	add_name = entry5.get().strip()
	if len(add_name)<=0:
		tkinter.messagebox.showerror("Error","請(qǐng)輸入名字")
		return None

	add_gender = combobox_3.current()
	if add_gender < 0:
		tkinter.messagebox.showerror("Error","請(qǐng)選擇性別")
		return None

	add_age = entry7.get().strip()
	if len(add_age)<=0:
		tkinter.messagebox.showerror("Error","請(qǐng)輸入年齡")
		return None
	try:
		add_age = int(add_age)
	except Exception as e:
		tkinter.messagebox.showerror("Error","年齡輸入錯(cuò)誤")
		return None

	add_grade = entry7.get().strip()
	if len(add_grade)<=0:
		tkinter.messagebox.showerror("Error","請(qǐng)輸入年級(jí)")
		return None
	try:
		add_grade = int(add_grade)
	except Exception as e:
		tkinter.messagebox.showerror("Error","輸入年級(jí)錯(cuò)誤")
		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("數(shù)據(jù)庫未連接,請(qǐng)檢查數(shù)據(jù)庫服務(wù)是否啟動(dòng)")
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("錯(cuò)誤","請(qǐng)選擇你的登陸身份")
 	elif len(username_input) == 0 or len(password_input) == 0:
 		tkinter.messagebox.showerror("錯(cuò)誤","請(qǐng)輸入用戶名和密碼")
 	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("錯(cuò)誤","用戶名或密碼錯(cuò)誤")
 		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("錯(cuò)誤","用戶名或密碼錯(cuò)誤")
 		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("錯(cuò)誤","用戶名或密碼錯(cuò)誤")
 

'''
Label(myWindow, text='身份無法修改',font=('Arial 12 bold'),width=10,height=1).grid(column = 0, row = 4)
	Label(myWindow, text='編號(hào)無法修改',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("錯(cuò)誤","請(qǐng)選擇要修改的數(shù)據(jù)")
	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 == "學(xué)生"):
			try:
				change_id = int(change_id)
			except Exception as e:
				tkinter.messagebox.showerror("錯(cuò)誤","輸入錯(cuò)誤")
				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("錯(cuò)誤","輸入錯(cuò)誤")
				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 == "學(xué)生"):
			try:
				change_age = int(change_age)
			except Exception as e:
				tkinter.messagebox.showerror("錯(cuò)誤","輸入錯(cuò)誤")
				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("錯(cuò)誤","輸入錯(cuò)誤")
				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 == "學(xué)生"):
			try:
				change_grade = int(change_grade)
			except Exception as e:
				tkinter.messagebox.showerror("錯(cuò)誤","輸入錯(cuò)誤")
				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("錯(cuò)誤","輸入錯(cuò)誤")
				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 == "學(xué)生"):
			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="搜索選項(xiàng):",font=('Arial 12 bold'),width=10,height=1).grid(column = 0, row = 0)
	combobox_1 = ttk.Combobox(myWindow, values = ['按編號(hào)搜索','按姓名搜索'], width=17)
	combobox_1.grid(column = 1, row = 0)

	Label(myWindow, text="搜索關(guān)鍵字:",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("錯(cuò)誤","請(qǐng)選擇搜索依據(jù)")
		return None
	if len(content) == 0:
		tkinter.messagebox.showerror("錯(cuò)誤","請(qǐng)輸入搜索內(nèi)容")
		return None

	if index == 0:
		try:
			search_id = int(content)
		except Exception as e:
			tkinter.messagebox.showerror("Error","請(qǐng)輸入正確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,'學(xué)生')
			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,'學(xué)生')
			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()
#設(shè)置標(biāo)題
myWindow.title('學(xué)生信息管理系統(tǒng)登陸')
myWindow.geometry('360x240')
#創(chuàng)建一個(gè)標(biāo)簽,顯示文本
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 = ['管理員','教師','學(xué)生'], 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)
#進(jìn)入消息循環(huán)
myWindow.mainloop()

'''
myWindow = Tk()
	#設(shè)置標(biāo)題
	myWindow.title('學(xué)生界面')
	myWindow.geometry('1280x640')
	Label(myWindow, text='輸入學(xué)號(hào)查詢信息',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","請(qǐng)輸入學(xué)號(hào)")
	try:
		content = int(content)
	except Exception as e:
		tkinter.messagebox.showerror("Error","請(qǐng)輸入正確學(xué)號(hào)")
		return None
	
	cursor.execute("select * from student_info where id = %d" % content)
	data = cursor.fetchall()
	if len(data) == 0:
		tkinter.messagebox.showerror("Error","學(xué)號(hào)不存在")	
		return None
	tkinter.messagebox.showinfo("學(xué)生信息","學(xué)號(hào):%d\n姓名:%s\n性別:%s\n年齡:%d\n年級(jí):%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()
	#設(shè)置標(biāo)題
	myWindow.title('管理員界面')
	myWindow.geometry('1280x640')
	#創(chuàng)建一個(gè)標(biāo)簽,顯示文本
	Label(myWindow, text="搜索選項(xiàng):",font=('Arial 12 bold'),width=10,height=1).grid(column = 0, row = 0)
	combobox_1 = ttk.Combobox(myWindow, values = ['按編號(hào)搜索','按姓名搜索'], width=17)
	combobox_1.grid(column = 1, row = 0)

	Label(myWindow, text="搜索關(guān)鍵字:",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 = '顯示所有學(xué)生信息',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="編號(hào)",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="年級(jí)",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='編號(hào)無法修改',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 = ['學(xué)生','教師'], 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)
	#進(jìn)入消息循環(huán)
	myWindow.mainloop()


elif mode == 1:
	print("asdasd")
	page = 0
	who = 1
	#初始化Tk()
	myWindow = Tk()
	#設(shè)置標(biāo)題
	myWindow.title('教師界面')
	myWindow.geometry('1280x640')
	#創(chuàng)建一個(gè)標(biāo)簽,顯示文本
	Label(myWindow, text="搜索選項(xiàng):",font=('Arial 12 bold'),width=10,height=1).grid(column = 0, row = 0)
	combobox_1 = ttk.Combobox(myWindow, values = ['按編號(hào)搜索','按姓名搜索'], width=17)
	combobox_1.grid(column = 1, row = 0)

	Label(myWindow, text="搜索關(guān)鍵字:",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 = '顯示所有學(xué)生信息',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="編號(hào)",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="年級(jí)",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='編號(hào)無法修改',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 = ['學(xué)生'], 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)
	#進(jìn)入消息循環(huán)
	myWindow.mainloop()


elif mode == 2:
	myWindow = Tk()
	#設(shè)置標(biāo)題
	myWindow.title('學(xué)生界面')
	myWindow.geometry('1280x640')
	Label(myWindow, text='輸入學(xué)號(hào)查詢信息',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()


            
          

?

?

?

?

?


更多文章、技術(shù)交流、商務(wù)合作、聯(lián)系博主

微信掃碼或搜索:z360901061

微信掃一掃加我為好友

QQ號(hào)聯(lián)系: 360901061

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描下面二維碼支持博主2元、5元、10元、20元等您想捐的金額吧,狠狠點(diǎn)擊下面給點(diǎn)支持吧,站長非常感激您!手機(jī)微信長按不能支付解決辦法:請(qǐng)將微信支付二維碼保存到相冊(cè),切換到微信,然后點(diǎn)擊微信右上角掃一掃功能,選擇支付二維碼完成支付。

【本文對(duì)您有幫助就好】

您的支持是博主寫作最大的動(dòng)力,如果您喜歡我的文章,感覺我的文章對(duì)您有幫助,請(qǐng)用微信掃描上面二維碼支持博主2元、5元、10元、自定義金額等您想捐的金額吧,站長會(huì)非常 感謝您的哦!!!

發(fā)表我的評(píng)論
最新評(píng)論 總共0條評(píng)論
主站蜘蛛池模板: 久久久婷婷亚洲5月97色 | 国产 日韩 欧美 亚洲 | 99综合在线 | 中文字幕第一区 | 亚洲精品国产v片在线观看 亚洲精品国产啊女成拍色拍 | 日本不卡在线一区二区三区视频 | 日日噜噜噜夜夜爽爽狠狠图片 | 日本中文字幕永久在线 | 欧美刺激午夜性久久久久久久 | 在线播放heyzo北条麻妃 | 全部毛片免费看 | 国产欧美视频综合二区 | 露脸真实国产精品自在 | 特黄aa级毛片免费视频播放 | 99热久久只有精品6国产32 | 五月天婷亚洲天综合网精品偷 | 老司机永久免费网站在线观看 | 国产成人精品日本亚洲语言 | 欧美一区二区在线免费观看 | 久久黄色网址 | 中文字幕亚洲一区二区v@在线 | 精品久久久久久中文字幕无碍 | 久久久久久久爱综合 | 日本人69视频jizz免费看 | 国产一级黄色录像 | 福利资源在线 | 亚洲经典在线中文字幕 | 射吧亚洲| 国产精品美女在线 | 亚洲色五月 | 欧美成人亚洲高清在线观看 | 亚洲伦理中文字幕 | 西西做人爱免费视频 | 在线成人免费观看国产精品 | 亚洲区一 | 欧美一级特黄毛片免费 | 一区二区三 | 91九色视频在线观看 | 亚洲成人免费在线观看 | 亚洲欧美国产精品 | 欧美成人精品一区二三区在线观看 |