欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

python?tkinter實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)

 更新時(shí)間:2022年02月25日 16:36:02   作者:coder默跡  
這篇文章主要為大家詳細(xì)介紹了python?tkinter實(shí)現(xiàn)學(xué)生信息管理系統(tǒng),文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下

本文實(shí)例為大家分享了python tkinter實(shí)現(xiàn)學(xué)生信息管理系統(tǒng)的具體代碼,供大家參考,具體內(nèi)容如下

初學(xué)python,代碼寫(xiě)的比較繁雜,系統(tǒng)功能還有完善的空間

系統(tǒng)使用了mysql數(shù)據(jù)庫(kù),數(shù)據(jù)庫(kù):sch,用戶(hù)名:root ,密碼:123456,創(chuàng)建表的語(yǔ)句寫(xiě)在代碼里面了

?import tkinter
import tkinter.messagebox
import re
import pymysql
from tkinter import scrolledtext
import os
from tkinter import *
def window_info(main):
? ? ? ? w = main.winfo_screenwidth()
? ? ? ? h = main.winfo_screenheight()
? ? ? ? x = (w / 2) - 200
? ? ? ? y = (h / 2) - 200
? ? ? ? return (x, y)
def conn():
? ? con = pymysql.connect("localhost", "root", "root", "sch")
? ? return con
?
def cur(connection):
? ? cur = connection.cursor()
? ? return cur
def exitsys():
? ? root.destroy()
def teacherlogin():
? ? #===============================================================================
? ? def managerindex():
? ? ? ? def addstudent():
? ? ? ? ? ? def addone():
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? cursor.execute('insert into student values(%s,%s,%s,%s,%s)',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(addnameentry.get(), addageentry.get(),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? addnoentry.get(), addclassentry.get(),'未注冊(cè)'))
? ? ? ? ? ? ? ? ? ? connection.commit()
? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? if addsuccessentry.get() != '':
? ? ? ? ? ? ? ? ? ? ? ? addsuccessentry.delete('0', 'end')
? ? ? ? ? ? ? ? ? ? ? ? addsuccessentry.insert('0', '添加失敗!')
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? addsuccessentry.insert('0', '添加失敗!')
? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? cursor.close
? ? ? ? ? ? ? ? if addsuccessentry.get() != '':
? ? ? ? ? ? ? ? ? ? addsuccessentry.delete('0', 'end')
? ? ? ? ? ? ? ? ? ? addsuccessentry.insert('0', '添加成功!')
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? addsuccessentry.insert('0', '添加成功!')
?
? ? ? ? ? ? def addcancel():
? ? ? ? ? ? ? ? addnameentry.delete('0', 'end')
? ? ? ? ? ? ? ? addageentry.delete('0', 'end')
? ? ? ? ? ? ? ? addnoentry.delete('0', 'end')
? ? ? ? ? ? ? ? addclassentry.delete('0', 'end')
? ? ? ? ? ? ? ? addsuccessentry.delete('0', 'end')
?
? ? ? ? ? ? def exit():
? ? ? ? ? ? ? ? add.destroy()
?
? ? ? ? ? ? add = Toplevel()
? ? ? ? ? ? add.title('添加學(xué)生信息')
? ? ? ? ? ? x, y = window_info(add)
? ? ? ? ? ? add.geometry("415x295+%d+%d" % (x, y))
? ? ? ? ? ? add['bg'] = 'dodgerblue'
?
? ? ? ? ? ? labelname = tkinter.Label(add, text='添加學(xué)生', width=80, bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=140, y=50, width=150, height=20)
?
? ? ? ? ? ? labelname = tkinter.Label(add, text='學(xué)生名:', width=80)
? ? ? ? ? ? labelname.place(x=140, y=80, width=60, height=20)
? ? ? ? ? ? addnameentry = tkinter.Entry(add, width=200)
? ? ? ? ? ? addnameentry.place(x=195, y=80, width=80, height=20)
?
? ? ? ? ? ? labelage = tkinter.Label(add, text='年 ?齡:', width=80)
? ? ? ? ? ? labelage.place(x=140, y=110, width=60, height=20)
? ? ? ? ? ? addageentry = tkinter.Entry(add, width=200)
? ? ? ? ? ? addageentry.place(x=195, y=110, width=80, height=20)
?
? ? ? ? ? ? labelno = tkinter.Label(add, text='學(xué) 號(hào):', width=80)
? ? ? ? ? ? labelno.place(x=140, y=140, width=60, height=20)
? ? ? ? ? ? addnoentry = tkinter.Entry(add, width=200)
? ? ? ? ? ? addnoentry.place(x=195, y=140, width=80, height=20)
?
? ? ? ? ? ? labelclass = tkinter.Label(add, text='班 ?級(jí):', width=80)
? ? ? ? ? ? labelclass.place(x=140, y=170, width=60, height=20)
? ? ? ? ? ? addclassentry = tkinter.Entry(add, width=200)
? ? ? ? ? ? addclassentry.place(x=195, y=170, width=80, height=20)
?
? ? ? ? ? ? addsuccessentry = tkinter.Entry(add, width=200, state='normal')
? ? ? ? ? ? addsuccessentry.place(x=140, y=200, width=135, height=20)
?
? ? ? ? ? ? buttonadd = tkinter.Button(add, text="添加", command=addone)
? ? ? ? ? ? buttonadd.place(x=140, y=230, width=50, height=20)
?
? ? ? ? ? ? buttoncancel = tkinter.Button(add, text="重置", command=addcancel)
? ? ? ? ? ? buttoncancel.place(x=220, y=230, width=50, height=20)
?
? ? ? ? ? ? add.mainloop()
? ? ? ? ? ? return add
? ? ? ? ? ? # ===================================================================================
?
? ? ? ? def findonestudent():
? ? ? ? ? ? def search():
? ? ? ? ? ? ? ? if textsearch.get('1.0', 'end') != '':
? ? ? ? ? ? ? ? ? ? textsearch.delete('1.0', 'end')
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? ? ? cursor.execute('select * from student where sno=%s', (entrysearchone.get()))
? ? ? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchone())
? ? ? ? ? ? ? ? ? ? ? ? textsearch.insert('insert', "學(xué)生姓名:" + data[0]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + "\n" + "年齡:" + data[1]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + "\n" + "學(xué)號(hào)" + data[2]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + "\n" + "班級(jí):" + data[3] + "\n\n")
? ? ? ? ? ? ? ? ? ? ? ? connection.commit()
? ? ? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? ? ? cursor.close
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? cursor.execute('select * from student where sno=%s', (entrysearchone.get()))
? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchone())
? ? ? ? ? ? ? ? ? ? textsearch.insert('insert', "學(xué)生姓名:" + data[0]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + "\n" + "年齡:" + data[1]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + "\n" + "學(xué)號(hào)" + data[2]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + "\n" + "班級(jí):" + data[3] + "\n\n")
? ? ? ? ? ? ? ? ? ? connection.commit()
? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? cursor.close
?
? ? ? ? ? ? def searchonecancel():
? ? ? ? ? ? ? ? textsearch.delete('1.0', 'end')
?
? ? ? ? ? ? def searchnocancel():
? ? ? ? ? ? ? ? entrysearchone.delete('0', 'end')
?
? ? ? ? ? ? def exit():
? ? ? ? ? ? ? ? findone.destroy()
?
? ? ? ? ? ? findone = Toplevel()
? ? ? ? ? ? findone.title('查詢(xún)學(xué)生信息')
? ? ? ? ? ? x, y = window_info(findone)
? ? ? ? ? ? findone.geometry("415x295+%d+%d" % (x, y))
? ? ? ? ? ? findone['bg'] = 'dodgerblue'
?
? ? ? ? ? ? labelname = tkinter.Label(findone, text='請(qǐng)輸入要查詢(xún)學(xué)生的學(xué)號(hào):', width=80, bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=140, y=50, width=140, height=20)
?
? ? ? ? ? ? entrysearchone = tkinter.Entry(findone, width=200)
? ? ? ? ? ? entrysearchone.place(x=140, y=80, width=150, height=20)
?
? ? ? ? ? ? buttonsearch = tkinter.Button(findone, text="查找", command=search)
? ? ? ? ? ? buttonsearch.place(x=140, y=110, width=50, height=20)
?
? ? ? ? ? ? buttonsearch = tkinter.Button(findone, text="重置", command=searchnocancel)
? ? ? ? ? ? buttonsearch.place(x=240, y=110, width=50, height=20)
?
? ? ? ? ? ? textsearch = tkinter.scrolledtext.ScrolledText(findone, width=18, height=6)
? ? ? ? ? ? textsearch.place(x=140, y=140)
?
? ? ? ? ? ? buttoncancel = tkinter.Button(findone, text="清空", command=searchonecancel)
? ? ? ? ? ? buttoncancel.place(x=190, y=230, width=50, height=20)
?
? ? ? ? ? ? findone.mainloop()
?
? ? ? ? # ==================================================================================
? ? ? ? def deletestudent():
? ? ? ? ? ? def deleteone():
? ? ? ? ? ? ? ? if deleteoneentry.get() == '':
? ? ? ? ? ? ? ? ? ? tkinter.messagebox.showerror('error', message="請(qǐng)輸入學(xué)號(hào)!")
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? if textdelete.get('1.0', 'end') != '':
? ? ? ? ? ? ? ? ? ? ? ? textdelete.delete('1.0', 'end')
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? ? ? ? ? cursor.execute('delete from student where sno=%s', (deleteoneentry.get()))
? ? ? ? ? ? ? ? ? ? ? ? ? ? connection.commit()
? ? ? ? ? ? ? ? ? ? ? ? ? ? cursor.execute('select * from student')
? ? ? ? ? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchall())
? ? ? ? ? ? ? ? ? ? ? ? ? ? textdelete.insert('insert', "姓名:\t\t年齡:\t\t學(xué)號(hào):\t\t班級(jí):")
? ? ? ? ? ? ? ? ? ? ? ? ? ? textdelete.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? ? ? ? ? for i in data:
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? print(i)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? textdelete.insert('insert', '\t\t'.join(i))
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? textdelete.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? ? ? ? ? cursor.close
? ? ? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? ? ? cursor.execute('delete from student where sno=%s', (deleteoneentry.get()))
? ? ? ? ? ? ? ? ? ? ? ? connection.commit()
? ? ? ? ? ? ? ? ? ? ? ? cursor.execute('select * from student')
? ? ? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchall())
? ? ? ? ? ? ? ? ? ? ? ? textdelete.insert('insert', "姓名:\t\t年齡:\t\t學(xué)號(hào):\t\t班級(jí):")
? ? ? ? ? ? ? ? ? ? ? ? textdelete.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? ? ? for i in data:
? ? ? ? ? ? ? ? ? ? ? ? ? ? print(i)
? ? ? ? ? ? ? ? ? ? ? ? ? ? textdelete.insert('insert', '\t\t'.join(i))
? ? ? ? ? ? ? ? ? ? ? ? ? ? textdelete.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? ? ? cursor.close
?
? ? ? ? ? ? def exit():
? ? ? ? ? ? ? ? deleteone.destroy()
?
? ? ? ? ? ? def deleteonecancel():
? ? ? ? ? ? ? ? deleteoneentry.delete('0', 'end')
?
? ? ? ? ? ? delete = Toplevel()
? ? ? ? ? ? delete.title('刪除學(xué)生信息')
? ? ? ? ? ? x, y = window_info(delete)
? ? ? ? ? ? delete.geometry("415x295+%d+%d" % (x, y))
? ? ? ? ? ? delete['bg'] = 'dodgerblue'
?
? ? ? ? ? ? labelname = tkinter.Label(delete, text='請(qǐng)輸入要?jiǎng)h除學(xué)生的學(xué)號(hào):', bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=5, y=20, width=140, height=20)
?
? ? ? ? ? ? deleteoneentry = tkinter.Entry(delete, width=200)
? ? ? ? ? ? deleteoneentry.place(x=5, y=50, width=150, height=20)
?
? ? ? ? ? ? buttondelete = tkinter.Button(delete, text="刪除", command=deleteone)
? ? ? ? ? ? buttondelete.place(x=5, y=80, width=50, height=20)
?
? ? ? ? ? ? buttondelete = tkinter.Button(delete, text="重置", command=deleteonecancel)
? ? ? ? ? ? buttondelete.place(x=105, y=80, width=50, height=20)
?
? ? ? ? ? ? textdelete = tkinter.scrolledtext.ScrolledText(delete, width=54, height=9)
? ? ? ? ? ? textdelete.place(x=5, y=110)
?
? ? ? ? ? ? delete.mainloop()
?
? ? ? ? # =======================================================================================
? ? ? ? def findallstudent():
? ? ? ? ? ? def show():
? ? ? ? ? ? ? ? if textshow.get('1.0', 'end') != '':
? ? ? ? ? ? ? ? ? ? textshow.delete('1.0', 'end')
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? ? ? cursor.execute('select * from student')
? ? ? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchall())
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "姓名:\t\t年齡:\t\t學(xué)號(hào):\t\t班級(jí):\t\t登錄密碼:")
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? ? ? for i in data:
? ? ? ? ? ? ? ? ? ? ? ? ? ? print(i)
? ? ? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', '\t\t'.join(i))
? ? ? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? ? ? cursor.close
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? cursor.execute('select * from student')
? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchall())
? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "姓名:\t\t年齡:\t\t學(xué)號(hào):\t\t班級(jí):\t\t登錄密碼:")
? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? for i in data:
? ? ? ? ? ? ? ? ? ? ? ? print(i)
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', '\t\t'.join(i))
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? cursor.close
?
? ? ? ? ? ? def searchallcancel():
? ? ? ? ? ? ? ? textshow.delete('1.0', 'end')
?
? ? ? ? ? ? def exit():
? ? ? ? ? ? ? ? findall.destroy()
?
? ? ? ? ? ? findall = Toplevel()
? ? ? ? ? ? findall.title('查詢(xún)所有學(xué)生信息')
? ? ? ? ? ? x, y = window_info(findall)
? ? ? ? ? ? findall.geometry("520x295+%d+%d" % (x, y))
? ? ? ? ? ? findall['bg'] = 'dodgerblue'
? ? ? ? ? ? labelname = tkinter.Label(findall, text='查詢(xún)所有學(xué)生信息?', bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=5, y=20, width=100, height=20)
?
? ? ? ? ? ? buttonshow = tkinter.Button(findall, text="確定", command=show)
? ? ? ? ? ? buttonshow.place(x=5, y=50, width=50, height=20)
?
? ? ? ? ? ? textshow = tkinter.scrolledtext.ScrolledText(findall, width=75, height=9)
? ? ? ? ? ? textshow.place(x=5, y=80)
?
? ? ? ? ? ? buttoncancel = tkinter.Button(findall, text="清空", command=searchallcancel)
? ? ? ? ? ? buttoncancel.place(x=5, y=210, width=50, height=20)
?
? ? ? ? ? ? findall.mainloop()
?
? ? ? ? # =======================================================================================
? ? ? ? def modifystudent():
? ? ? ? ? ? def modifyfindone():
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? cursor.execute('select * from student where sno=%s', (modifyoneentry.get()))
? ? ? ? ? ? ? ? ? ? connection.commit()
? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? cursor.close
? ? ? ? ? ? ? ? data = list(cursor.fetchall())
? ? ? ? ? ? ? ? if data == []:
? ? ? ? ? ? ? ? ? ? tkinter.messagebox.showerror(message="沒(méi)有查詢(xún)到該學(xué)生的信息!")
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? modifynameentry.insert('0', data[0][0])
? ? ? ? ? ? ? ? ? ? modifyageentry.insert('0', data[0][1])
? ? ? ? ? ? ? ? ? ? modifynoentry.insert('0', data[0][2])
? ? ? ? ? ? ? ? ? ? modifyclassentry.insert('0', data[0][3])
?
? ? ? ? ? ? def submit():
? ? ? ? ? ? ? ? print(modifynameentry.get())
? ? ? ? ? ? ? ? print(modifyoneentry.get())
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? sqlname = "update student set sname = %s where sno = %s"
? ? ? ? ? ? ? ? cursor.execute(sqlname, (modifynameentry.get(), modifyoneentry.get()))
? ? ? ? ? ? ? ? sqlage = "update student set sage = %s where sno = %s"
? ? ? ? ? ? ? ? cursor.execute(sqlage, (modifyageentry.get(), modifyoneentry.get()))
? ? ? ? ? ? ? ? sqlno = "update student set sno = %s where sno = %s"
? ? ? ? ? ? ? ? cursor.execute(sqlno, (modifynoentry.get(), modifyoneentry.get()))
? ? ? ? ? ? ? ? sqlclass = "update student set sclass = %s where sno = %s"
? ? ? ? ? ? ? ? cursor.execute(sqlclass, (modifyclassentry.get(), modifyoneentry.get()))
? ? ? ? ? ? ? ? connection.commit()
? ? ? ? ? ? ? ? if modifysuccessentry.get() != '':
? ? ? ? ? ? ? ? ? ? modifysuccessentry.delete('0', 'end')
? ? ? ? ? ? ? ? ? ? modifysuccessentry.insert('0', '修改成功!')
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? modifysuccessentry.insert('0', '修改成功!')
?
? ? ? ? ? ? modify = Toplevel()
? ? ? ? ? ? modify.title('修改學(xué)生信息')
? ? ? ? ? ? x, y = window_info(modify)
? ? ? ? ? ? modify.geometry("415x295+%d+%d" % (x, y))
? ? ? ? ? ? modify['bg'] = 'dodgerblue'
? ? ? ? ? ? labelname = tkinter.Label(modify, text='請(qǐng)輸入要修改學(xué)生的學(xué)號(hào):', bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=5, y=20, width=140, height=20)
?
? ? ? ? ? ? buttonshow = tkinter.Button(modify, text="確定", command=modifyfindone)
? ? ? ? ? ? buttonshow.place(x=155, y=50, width=50, height=20)
?
? ? ? ? ? ? modifyoneentry = tkinter.Entry(modify, width=200)
? ? ? ? ? ? modifyoneentry.place(x=5, y=50, width=150, height=20)
?
? ? ? ? ? ? labelname = tkinter.Label(modify, text='該學(xué)生信息如下', bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=5, y=70, width=85, height=20)
?
? ? ? ? ? ? labelname = tkinter.Label(modify, text='姓名:',bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=5, y=100, width=30, height=20)
? ? ? ? ? ? modifynameentry = tkinter.Entry(modify, width=200)
? ? ? ? ? ? modifynameentry.place(x=5, y=120, width=150, height=20)
?
? ? ? ? ? ? labelname = tkinter.Label(modify, text='年齡:',bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=200, y=100, width=30, height=20)
? ? ? ? ? ? modifyageentry = tkinter.Entry(modify, width=200)
? ? ? ? ? ? modifyageentry.place(x=200, y=120, width=150, height=20)
?
? ? ? ? ? ? labelname = tkinter.Label(modify, text='學(xué)號(hào):',bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=5, y=150, width=30, height=20)
? ? ? ? ? ? modifynoentry = tkinter.Entry(modify, width=200)
? ? ? ? ? ? modifynoentry.place(x=5, y=170, width=150, height=20)
?
? ? ? ? ? ? labelname = tkinter.Label(modify, text='班級(jí):',bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=200, y=150, width=30, height=20)
? ? ? ? ? ? modifyclassentry = tkinter.Entry(modify, width=200)
? ? ? ? ? ? modifyclassentry.place(x=200, y=170, width=150, height=20)
?
? ? ? ? ? ? modifysuccessentry = tkinter.Entry(modify, width=200)
? ? ? ? ? ? modifysuccessentry.place(x=5, y=200, width=150, height=20)
?
? ? ? ? ? ? buttonshow = tkinter.Button(modify, text="提 ?交", command=submit)
? ? ? ? ? ? buttonshow.place(x=5, y=230, width=50, height=20)
? ? ? ? ? ? modify.mainloop()
?
? ? ? ? # ==================================================================================
? ? ? ? def findselectcourseinfor():
? ? ? ? ? ? def show():
? ? ? ? ? ? ? ? print('swj')
? ? ? ? ? ? ? ? if textshow.get('1.0', 'end') != '':
? ? ? ? ? ? ? ? ? ? textshow.delete('1.0', 'end')
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? ? ? cursor.execute('select sno,sname,sclass,cno,cname from student,course where student.sno=sc.sno and course.cno=sc.cno')
? ? ? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchall())
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "學(xué)號(hào):\t\t姓名:\t\t班級(jí):\t\t課程編號(hào):\t\t課程名:")
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? ? ? for i in data:
? ? ? ? ? ? ? ? ? ? ? ? ? ? print(i)
? ? ? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', '\t\t'.join(i))
? ? ? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? ? ? cursor.close
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? cursor.execute('select sc.sno,sname,sclass,sc.cno,course.cname from student,course,sc where student.sno=sc.sno and course.cno=sc.cno')
? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchall())
? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "學(xué)號(hào):\t\t姓名:\t\t班級(jí):\t\t課程編號(hào):\t\t課程名:")
? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? for i in data:
? ? ? ? ? ? ? ? ? ? ? ? print(i)
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', '\t\t'.join(i))
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? cursor.close
?
? ? ? ? ? ? def searchallcancel():
? ? ? ? ? ? ? ? textshow.delete('1.0', 'end')
? ? ? ? ? ? findall = Toplevel()
? ? ? ? ? ? findall.title('查詢(xún)學(xué)生選課信息')
? ? ? ? ? ? x, y = window_info(findall)
? ? ? ? ? ? findall.geometry("520x295+%d+%d" % (x, y))
? ? ? ? ? ? findall['bg'] = 'dodgerblue'
? ? ? ? ? ? labelname = tkinter.Label(findall, text='查詢(xún)學(xué)生選課信息?', bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=5, y=20, width=100, height=20)
?
? ? ? ? ? ? buttonshow = tkinter.Button(findall, text="確定", command=show)
? ? ? ? ? ? buttonshow.place(x=5, y=50, width=50, height=20)
?
? ? ? ? ? ? textshow = tkinter.scrolledtext.ScrolledText(findall, width=105, height=9)
? ? ? ? ? ? textshow.place(x=5, y=80)
?
? ? ? ? ? ? buttoncancel = tkinter.Button(findall, text="清空", command=searchallcancel)
? ? ? ? ? ? buttoncancel.place(x=5, y=210, width=50, height=20)
?
? ? ? ? ? ? findall.mainloop()
?
?
?
?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? #===================================================================================
? ? ? ? def addcourse():
? ? ? ? ? ? def addonecourse():
? ? ? ? ? ??
? ? ? ? ? ? ? ? print(addcnoentry.get())
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? cursor.execute('insert into course values(%s,%s,%s)',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(addcnoentry.get(), addcnameentry.get(),
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? addtnoentry.get()))
? ? ? ? ? ? ? ? ? ? connection.commit()
? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? if addsuccessentry.get() != '':
? ? ? ? ? ? ? ? ? ? ? ? addsuccessentry.delete('0', 'end')
? ? ? ? ? ? ? ? ? ? ? ? addsuccessentry.insert('0', '添加失敗!')
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? addsuccessentry.insert('0', '添加失敗!')
? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? cursor.close
? ? ? ? ? ? ? ? if addsuccessentry.get() != '':
? ? ? ? ? ? ? ? ? ? addsuccessentry.delete('0', 'end')
? ? ? ? ? ? ? ? ? ? addsuccessentry.insert('0', '添加成功!')
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? addsuccessentry.insert('0', '添加成功!')
?
? ? ? ? ? ? def addcancel():
? ? ? ? ? ? ? ? addcnoentry.delete('0', 'end')
? ? ? ? ? ? ? ? addcnameentry.delete('0', 'end')
? ? ? ? ? ? ? ? addtnoentry.delete('0', 'end')
? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? addsuccessentry.delete('0', 'end')
?
?
? ? ? ? ? ? addcourse = Toplevel()
? ? ? ? ? ? addcourse.title('添加學(xué)生信息')
? ? ? ? ? ? x, y = window_info(addcourse)
? ? ? ? ? ? addcourse.geometry("415x295+%d+%d" % (x, y))
? ? ? ? ? ? addcourse['bg'] = 'dodgerblue'
?
? ? ? ? ? ? labelname = tkinter.Label(addcourse, text='添加學(xué)生', width=80, bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=140, y=50, width=150, height=20)
?
? ? ? ? ? ? labelname = tkinter.Label(addcourse, text='課程號(hào):', width=80)
? ? ? ? ? ? labelname.place(x=140, y=80, width=60, height=20)
? ? ? ? ? ? addcnoentry = tkinter.Entry(addcourse, width=200)
? ? ? ? ? ? addcnoentry.place(x=195, y=80, width=80, height=20)
?
? ? ? ? ? ? labelage = tkinter.Label(addcourse, text='課程名:', width=80)
? ? ? ? ? ? labelage.place(x=140, y=110, width=60, height=20)
? ? ? ? ? ? addcnameentry = tkinter.Entry(addcourse, width=200)
? ? ? ? ? ? addcnameentry.place(x=195, y=110, width=80, height=20)
?
? ? ? ? ? ? labelno = tkinter.Label(addcourse, text='教師編號(hào):', width=80)
? ? ? ? ? ? labelno.place(x=140, y=140, width=60, height=20)
? ? ? ? ? ? addtnoentry = tkinter.Entry(addcourse, width=200)
? ? ? ? ? ? addtnoentry.place(x=195, y=140, width=80, height=20)
?
? ? ? ? ? ??
? ? ? ? ? ? addsuccessentry = tkinter.Entry(addcourse, width=200, state='normal')
? ? ? ? ? ? addsuccessentry.place(x=140, y=170, width=135, height=20)
?
? ? ? ? ? ? buttonadd = tkinter.Button(addcourse, text="添加", command=addonecourse)
? ? ? ? ? ? buttonadd.place(x=140, y=200, width=50, height=20)
?
? ? ? ? ? ? buttoncancel = tkinter.Button(addcourse, text="重置", command=addcancel)
? ? ? ? ? ? buttoncancel.place(x=220, y=200, width=50, height=20)
?
? ? ? ? ? ? addcourse.mainloop()
? ? ? ??
? ? ? ? def exitsys():
? ? ? ? ? ? root.destroy()
? ? ? ? ? ??
? ? ? ? studentindex = Toplevel()
? ? ? ? studentindex.title('學(xué)生信息管理系統(tǒng)')
? ? ? ? x, y = window_info(studentindex)
? ? ? ? studentindex.geometry("430x505+%d+%d" % (x, y))
? ? ? ? studentindex['bg'] = 'dodgerblue'
?
? ? ? ? labelname = tkinter.Label(studentindex, text='歡迎使用學(xué)生信息管理系統(tǒng)', bg='dodgerblue', font=("楷體", 20))
? ? ? ? labelname.place(x=60, y=30, width=350, height=40)
?
? ? ? ? buttonadd = tkinter.Button(studentindex, text="添 ? ?加", command=addstudent)
? ? ? ? buttonadd.place(x=150, y=90, width=100, height=40)
?
? ? ? ? buttonadd = tkinter.Button(studentindex, text="查 ? ?詢(xún)", command=findonestudent)
? ? ? ? buttonadd.place(x=150, y=140, width=100, height=40)
?
? ? ? ? buttonadd = tkinter.Button(studentindex, text="刪 ? ?除", command=deletestudent)
? ? ? ? buttonadd.place(x=150, y=190, width=100, height=40)
?
? ? ? ? buttonadd = tkinter.Button(studentindex, text="查詢(xún)所有", command=findallstudent)
? ? ? ? buttonadd.place(x=150, y=240, width=100, height=40)
?
? ? ? ? buttonadd = tkinter.Button(studentindex, text="修 ? ?改", command=modifystudent)
? ? ? ? buttonadd.place(x=150, y=290, width=100, height=40)
?
? ? ? ? buttonadd = tkinter.Button(studentindex, text="添加課程", command=addcourse)
? ? ? ? buttonadd.place(x=150, y=340, width=100, height=40)
?
? ? ? ? buttonadd = tkinter.Button(studentindex, text="學(xué)生選課信息", command=findselectcourseinfor)
? ? ? ? buttonadd.place(x=150, y=390, width=100, height=40)
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
? ? ? ? buttonadd = tkinter.Button(studentindex, text="退出系統(tǒng)", command=exitsys)
? ? ? ? buttonadd.place(x=150, y=440, width=100, height=40)
? ? ? ? studentindex.mainloop()
? ? # ===============================================================================
? ? def login():
? ? ? ? name = entryName.get()
? ? ? ? pwd = entryPwd.get()
? ? ? ? connection = conn()
? ? ? ? cursor = cur(connection)
? ? ? ? cursor.execute('select * from login')
? ? ? ? data = list(cursor.fetchall())
? ? ? ? print(data)
? ? ? ? if data == []:
? ? ? ? ? ? tkinter.messagebox.showerror(message="賬號(hào)或密碼錯(cuò)誤!")
? ? ? ? ? ? return 0
? ? ? ? for i in data:
? ? ? ? ? ? print(i[0])
? ? ? ? ? ? print(i[1])
? ? ? ? ? ? if i[0] == name and i[1] == pwd:
? ? ? ? ? ? ? ? managerindex()
?
? ? def forregister():
? ? ? ? def loginregister():
? ? ? ? ? ? if pwdentry.get() == '' or confirmpwdentry.get == '':
? ? ? ? ? ? ? ? tkinter.messagebox.showerror(message="請(qǐng)輸入賬號(hào)密碼!")
?
? ? ? ? ? ? elif pwdentry.get() == confirmpwdentry.get():
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? cursor.execute('insert into login(user,password)values(%s,%s)',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(userentry.get(), pwdentry.get()))
? ? ? ? ? ? ? ? ? ? connection.commit()
? ? ? ? ? ? ? ? ? ? if registersuccessentry.get() != '':
? ? ? ? ? ? ? ? ? ? ? ? registersuccessentry.delete('0', 'end')
? ? ? ? ? ? ? ? ? ? ? ? registersuccessentry.insert('0', '注冊(cè)成功!')
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? registersuccessentry.insert('0', '注冊(cè)成功!')
? ? ? ? ? ? ? ? ? ? bottonOk = tkinter.Button(studentregister, text="立即登錄", command=registerlogin, bg='dodgerblue')
? ? ? ? ? ? ? ? ? ? bottonOk.place(x=125, y=230, width=70, height=30)
? ? ? ? ? ? ? ? ? ? #return userentry.get(), pwdentry.get()
? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? if registersuccessentry.get() != '':
? ? ? ? ? ? ? ? ? ? ? ? registersuccessentry.delete('0', 'end')
? ? ? ? ? ? ? ? ? ? ? ? registersuccessentry.insert('0', '注冊(cè)失敗!')
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? registersuccessentry.insert('0', '注冊(cè)失敗!')
?
? ? ? ? ? ? else:
? ? ? ? ? ? ? ? tkinter.messagebox.showerror(message="兩次輸入的密碼不相同!")
?
? ? ? ? def registerlogin():
? ? ? ? ? ??
? ? ? ? ? ? managerindex()
?
? ? ? ? studentregister = Toplevel()
? ? ? ? x, y = window_info(studentregister)
? ? ? ? studentregister.title('學(xué)生信息管理系統(tǒng)')
? ? ? ? studentregister.geometry("415x295+%d+%d" % (x, y))
? ? ? ? studentregister['bg'] = 'dodgerblue'
?
? ? ? ? labelname = tkinter.Label(studentregister, text='注冊(cè)學(xué)生信息管理系統(tǒng)', bg='dodgerblue', font=("楷體", 20))
? ? ? ? labelname.place(x=60, y=30, width=300, height=40)
?
? ? ? ? labelName = tkinter.Label(studentregister, text="賬 ? ? ?號(hào):", bg='dodgerblue', width=80)
? ? ? ? labelName.place(x=115, y=110, width=80, height=20)
?
? ? ? ? userentry = tkinter.Entry(studentregister, width=80)
? ? ? ? userentry.place(x=210, y=110, width=80, height=20)
?
? ? ? ? labelPwd = tkinter.Label(studentregister, text="密 ? ? ?碼:", bg='dodgerblue', width=80)
? ? ? ? labelPwd.place(x=115, y=135, width=80, height=20)
?
? ? ? ? pwdentry = tkinter.Entry(studentregister, width=80)
? ? ? ? pwdentry.place(x=210, y=135, width=80, height=20)
?
? ? ? ? labelPwd = tkinter.Label(studentregister, text="確認(rèn)密碼:", bg='dodgerblue', width=80)
? ? ? ? labelPwd.place(x=115, y=160, width=80, height=20)
?
? ? ? ? confirmpwdentry = tkinter.Entry(studentregister, width=80)
? ? ? ? confirmpwdentry.place(x=210, y=160, width=80, height=20)
?
? ? ? ? registersuccessentry = tkinter.Entry(studentregister, width=80)
? ? ? ? registersuccessentry.place(x=125, y=190, width=165, height=20)
?
? ? ? ? bottonCancel = tkinter.Button(studentregister, text='注冊(cè)', command=loginregister, bg='dodgerblue')
? ? ? ? bottonCancel.place(x=225, y=230, width=70, height=30)
? ? ? ? studentregister.mainloop()
? ? manager = Toplevel()
? ? manager.title(' 管理員端')
? ? x, y = window_info(manager)
? ? manager.geometry("415x295+%d+%d" % (x, y))
? ? manager['bg'] = 'dodgerblue'
?
? ? varLoginName = tkinter.StringVar()
? ? varLoginPwd = tkinter.StringVar()
?
? ? labelname = tkinter.Label(manager, text='歡迎使用學(xué)生信息管理系統(tǒng)', bg='dodgerblue', font=("楷體", 18))
? ? labelname.place(x=60, y=30, width=300, height=40)
?
? ? labelName = tkinter.Label(manager, text="賬 ? ?號(hào):", justify=tkinter.RIGHT, bg='dodgerblue', width=80)
? ? labelName.place(x=110, y=110, width=80, height=20)
? ? labelPwd = tkinter.Label(manager, text="密 ? ?碼:", justify=tkinter.RIGHT, bg='dodgerblue', width=80)
? ? labelPwd.place(x=110, y=135, width=80, height=20)
?
? ? entryName = tkinter.Entry(manager, width=80, textvariable=varLoginName)
? ? entryName.place(x=210, y=110, width=80, height=20)
? ? entryPwd = tkinter.Entry(manager, show='*', width=80, textvariable=varLoginPwd)
? ? entryPwd.place(x=210, y=135, width=80, height=20)
?
? ? bottonOk = tkinter.Button(manager, text="登錄", command=login, bg='dodgerblue')
? ? bottonOk.place(x=125, y=170, width=70, height=30)
? ? bottonCancel = tkinter.Button(manager, text='注冊(cè)', command=forregister, bg='dodgerblue')
? ? bottonCancel.place(x=225, y=170, width=70, height=30)
?
? ? manager.mainloop()
?
def studentlogin():
? ? def forstudentregister():
? ? ? ??
? ? ? ? def loginregister():
? ? ? ? ? ? if pwdentry.get() == '' or confirmpwdentry.get == '':
? ? ? ? ? ? ? ? tkinter.messagebox.showerror(message="請(qǐng)輸入賬號(hào)密碼!")
?
? ? ? ? ? ? elif pwdentry.get() == confirmpwdentry.get():
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? sqlpwd = "update student set loginpwd = %s where sno = %s"
? ? ? ? ? ? ? ? ? ? cursor.execute(sqlpwd, ( pwdentry.get(),userentry.get()))
? ? ? ? ? ? ? ? ? ? connection.commit()
? ? ? ? ? ? ? ? ? ? if registersuccessentry.get() != '':
? ? ? ? ? ? ? ? ? ? ? ? registersuccessentry.delete('0', 'end')
? ? ? ? ? ? ? ? ? ? ? ? registersuccessentry.insert('0', '注冊(cè)成功!')
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? registersuccessentry.insert('0', '注冊(cè)成功!')
? ? ? ? ? ? ? ? ? ? bottonOk = tkinter.Button(studentregister, text="立即登錄", command=registerlogin, bg='dodgerblue')
? ? ? ? ? ? ? ? ? ? bottonOk.place(x=125, y=230, width=70, height=30)
? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? if registersuccessentry.get() != '':
? ? ? ? ? ? ? ? ? ? ? ? registersuccessentry.delete('0', 'end')
? ? ? ? ? ? ? ? ? ? ? ? registersuccessentry.insert('0', '注冊(cè)失敗!')
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? registersuccessentry.insert('0', '注冊(cè)失敗!')
?
? ? ? ? ? ? else:
? ? ? ? ? ? ? ? tkinter.messagebox.showerror(message="兩次輸入的密碼不相同!")
? ? ? ? ? ? ? ??
? ? ? ? ? ? return userentry.get()
? ? ? ??
? ? ? ? def registerlogin():
? ? ? ? ? ? studentindex(userentry.get())
? ? ? ? ? ??
? ? ? ? studentregister = Toplevel()
? ? ? ? x, y = window_info(studentregister)
? ? ? ? studentregister.title('學(xué)生信息管理系統(tǒng)-注冊(cè)')
? ? ? ? studentregister.geometry("415x295+%d+%d" % (x, y))
? ? ? ? studentregister['bg'] = 'dodgerblue'
?
? ? ? ? labelname = tkinter.Label(studentregister, text='注冊(cè)學(xué)生信息管理系統(tǒng)', bg='dodgerblue', font=("楷體", 20))
? ? ? ? labelname.place(x=60, y=30, width=300, height=40)
?
? ? ? ? labelName = tkinter.Label(studentregister, text="學(xué) ? ? ?號(hào):", bg='dodgerblue', width=80)
? ? ? ? labelName.place(x=115, y=110, width=80, height=20)
?
? ? ? ? userentry = tkinter.Entry(studentregister, width=80)
? ? ? ? userentry.place(x=210, y=110, width=80, height=20)
?
? ? ? ? labelPwd = tkinter.Label(studentregister, text="密 ? ? ?碼:", bg='dodgerblue', width=80)
? ? ? ? labelPwd.place(x=115, y=135, width=80, height=20)
?
? ? ? ? pwdentry = tkinter.Entry(studentregister, width=80)
? ? ? ? pwdentry.place(x=210, y=135, width=80, height=20)
?
? ? ? ? labelPwd = tkinter.Label(studentregister, text="確認(rèn)密碼:", bg='dodgerblue', width=80)
? ? ? ? labelPwd.place(x=115, y=160, width=80, height=20)
?
? ? ? ? confirmpwdentry = tkinter.Entry(studentregister, width=80)
? ? ? ? confirmpwdentry.place(x=210, y=160, width=80, height=20)
?
? ? ? ? registersuccessentry = tkinter.Entry(studentregister, width=80)
? ? ? ? registersuccessentry.place(x=125, y=190, width=165, height=20)
?
? ? ? ? bottonCancel = tkinter.Button(studentregister, text='注冊(cè)', command=loginregister, bg='dodgerblue')
? ? ? ? bottonCancel.place(x=225, y=230, width=70, height=30)
? ? ? ??
? ? ? ? studentregister.mainloop()
? ? def studentindex(name):
? ? ? ? loginingno=name
? ? ? ? print('sdfsdffds')
? ? ? ? def showinfor():
? ? ? ? ? ? def show():
? ? ? ? ? ? ? ? if textshowinformation.get('1.0', 'end') != '':
? ? ? ? ? ? ? ? ? ? textshowinformation.delete('1.0', 'end')
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ? ? ? print(loginingno)
? ? ? ? ? ? ? ? ? ? print('swj')
? ? ? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? ? ? cursor.execute('select * from student where sno=%s', (loginingno))
? ? ? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchone())
? ? ? ? ? ? ? ? ? ? ? ? textshowinformation.insert('insert', "學(xué)生姓名:" + data[0]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + "\n" + "年齡:" + data[1]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + "\n" + "學(xué)號(hào)" + data[2]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + "\n" + "班級(jí):" + data[3] + "\n\n")
? ? ? ? ? ? ? ? ? ? ? ? connection.commit()
? ? ? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? ? ? cursor.close
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? cursor.execute('select * from student where sno=%s', (loginingno))
? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchone())
? ? ? ? ? ? ? ? ? ? textshowinformation.insert('insert', "學(xué)生姓名:" + data[0]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + "\n" + "年齡:" + data[1]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + "\n" + "學(xué)號(hào)" + data[2]
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? + "\n" + "班級(jí):" + data[3] + "\n\n")
? ? ? ? ? ? ? ? ? ? connection.commit()
? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? cursor.close
? ? ? ? ? ? def showinforcancel():
? ? ? ? ? ? ? ? textshowinformation.delete('1.0', 'end')
? ? ? ? ? ? showinformation = Toplevel()
? ? ? ? ? ? showinformation.title('查詢(xún)學(xué)籍信息')
? ? ? ? ? ? x, y = window_info(showinformation)
? ? ? ? ? ? showinformation.geometry("415x295+%d+%d" % (x, y))
? ? ? ? ? ? showinformation['bg'] = 'dodgerblue'
? ? ? ? ? ? labelname = tkinter.Label(showinformation, text='查詢(xún)學(xué)籍信息?', bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=5, y=20, width=100, height=20)
?
? ? ? ? ? ? buttonshow = tkinter.Button(showinformation, text="確定", command=show)
? ? ? ? ? ? buttonshow.place(x=5, y=50, width=50, height=20)
?
? ? ? ? ? ? textshowinformation = tkinter.scrolledtext.ScrolledText(showinformation, width=60, height=9)
? ? ? ? ? ? textshowinformation.place(x=5, y=80)
?
? ? ? ? ? ? buttoncancel = tkinter.Button(showinformation, text="清空", command=showinforcancel)
? ? ? ? ? ? buttoncancel.place(x=5, y=210, width=50, height=20)
?
? ? ? ? ? ? showinformation.mainloop()
?
? ? ? ? def findcourseinfor():
? ? ? ? ? ? def show():
? ? ? ? ? ? ? ? if textshow.get('1.0', 'end') != '':
? ? ? ? ? ? ? ? ? ? textshow.delete('1.0', 'end')
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? ? ? cursor.execute('select * from course')
? ? ? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchall())
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "課程號(hào):\t\t\t課程名:\t\t\t教師編號(hào):")
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? ? ? for i in data:
? ? ? ? ? ? ? ? ? ? ? ? ? ? print(i)
? ? ? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', '\t\t'.join(i))
? ? ? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? ? ? cursor.close
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? cursor.execute('select * from course')
? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchall())
? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "課程號(hào):\t\t\t課程名:\t\t\t教師編號(hào):")
? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? for i in data:
? ? ? ? ? ? ? ? ? ? ? ? print(i)
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', '\t\t\t'.join(i))
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? cursor.close
?
? ? ? ? ? ? def searchallcancel():
? ? ? ? ? ? ? ? textshow.delete('1.0', 'end')
? ? ? ? ? ? findall = Toplevel()
? ? ? ? ? ? findall.title('查詢(xún)課程信息')
? ? ? ? ? ? x, y = window_info(findall)
? ? ? ? ? ? findall.geometry("520x295+%d+%d" % (x, y))
? ? ? ? ? ? findall['bg'] = 'dodgerblue'
? ? ? ? ? ? labelname = tkinter.Label(findall, text='查詢(xún)所有課程信息?', bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=5, y=20, width=100, height=20)
?
? ? ? ? ? ? buttonshow = tkinter.Button(findall, text="確定", command=show)
? ? ? ? ? ? buttonshow.place(x=5, y=50, width=50, height=20)
?
? ? ? ? ? ? textshow = tkinter.scrolledtext.ScrolledText(findall, width=75, height=9)
? ? ? ? ? ? textshow.place(x=5, y=80)
?
? ? ? ? ? ? buttoncancel = tkinter.Button(findall, text="清空", command=searchallcancel)
? ? ? ? ? ? buttoncancel.place(x=5, y=210, width=50, height=20)
?
? ? ? ? ? ? findall.mainloop()
? ? ? ? ? ??
? ? ? ? def selectcourse():
? ? ? ? ? ? def show():
? ? ? ? ? ? ? ? if textshow.get('1.0', 'end') != '':
? ? ? ? ? ? ? ? ? ? textshow.delete('1.0', 'end')
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? ? ? cursor.execute('select * from course')
? ? ? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchall())
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "課程號(hào):\t\t\t課程名:\t\t\t教師編號(hào):")
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? ? ? for i in data:
? ? ? ? ? ? ? ? ? ? ? ? ? ? print(i)
? ? ? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', '\t\t'.join(i))
? ? ? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? ? ? cursor.close
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? cursor.execute('select * from course')
? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchall())
? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "課程號(hào):\t\t\t課程名:\t\t\t教師編號(hào):")
? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? for i in data:
? ? ? ? ? ? ? ? ? ? ? ? print(i)
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', '\t\t\t'.join(i))
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? cursor.close
?
? ? ? ? ? ? def searchallcancel():
? ? ? ? ? ? ? ? textshow.delete('1.0', 'end')
? ? ? ? ? ? def select():
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? cursor.execute('insert into sc values(%s,%s)',
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?(loginingno, entrysearchone.get()))
? ? ? ? ? ? ? ? ? ? connection.commit()
? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? if addsuccessentry.get() != '':
? ? ? ? ? ? ? ? ? ? ? ? addsuccessentry.delete('0', 'end')
? ? ? ? ? ? ? ? ? ? ? ? addsuccessentry.insert('0', '選課失敗!')
? ? ? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? ? ? addsuccessentry.insert('0', '選課失敗!')
? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? cursor.close
? ? ? ? ? ? ? ? if addsuccessentry.get() != '':
? ? ? ? ? ? ? ? ? ? addsuccessentry.delete('0', 'end')
? ? ? ? ? ? ? ? ? ? addsuccessentry.insert('0', '選課成功!')
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? addsuccessentry.insert('0', '選課成功!')
?
? ? ? ? ? ? def addcancel():
? ? ? ? ? ? ? ? entrysearchone.delete('0', 'end')
? ? ? ? ? ? ? ? addsuccessentry.delete('0', 'end')
? ? ? ? ? ? ? ??
? ? ? ? ? ? ? ??
? ? ? ? ? ? findall = Toplevel()
? ? ? ? ? ? findall.title('學(xué)生選課')
? ? ? ? ? ? x, y = window_info(findall)
? ? ? ? ? ? findall.geometry("520x325+%d+%d" % (x, y))
? ? ? ? ? ? findall['bg'] = 'dodgerblue'
? ? ? ? ? ? labelname = tkinter.Label(findall, text='查詢(xún)所有課程信息?', bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=5, y=20, width=100, height=20)
?
? ? ? ? ? ? buttonshow = tkinter.Button(findall, text="確定", command=show)
? ? ? ? ? ? buttonshow.place(x=5, y=50, width=50, height=20)
?
? ? ? ? ? ? textshow = tkinter.scrolledtext.ScrolledText(findall, width=75, height=9)
? ? ? ? ? ? textshow.place(x=5, y=80)
?
? ? ? ? ? ? labelname = tkinter.Label(findall, text='請(qǐng)輸入課程編號(hào):', bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=5, y=210, width=100, height=20)
?
? ? ? ? ? ? entrysearchone = tkinter.Entry(findall, width=200)
? ? ? ? ? ? entrysearchone.place(x=5, y=240, width=150, height=20)
?
? ? ? ? ? ? addsuccessentry = tkinter.Entry(findall, width=200)
? ? ? ? ? ? addsuccessentry.place(x=5, y=270, width=75, height=20)?
? ? ? ? ? ??
? ? ? ? ? ? buttoncancel = tkinter.Button(findall, text="選擇", command=select)
? ? ? ? ? ? buttoncancel.place(x=5, y=300, width=50, height=20)
?
? ? ? ? ? ? buttoncancel = tkinter.Button(findall, text="重置", command=addcancel)
? ? ? ? ? ? buttoncancel.place(x=105, y=300, width=50, height=20)
?
? ? ? ? ? ? findall.mainloop()
? ? ? ? ? ??
? ? ? ? ? ??
? ? ? ? def findselectcourseinfor():
? ? ? ? ? ? def show():
? ? ? ? ? ? ? ? print('swj')
? ? ? ? ? ? ? ? if textshow.get('1.0', 'end') != '':
? ? ? ? ? ? ? ? ? ? textshow.delete('1.0', 'end')
? ? ? ? ? ? ? ? else:
? ? ? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? ? ? cursor.execute('select sno,sname,sclass,cno,cname from student,course where student.sno=sc.sno and course.cno=sc.cno and sno=%s',(loginingno))
? ? ? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchall())
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "學(xué)號(hào):\t\t姓名:\t\t班級(jí):\t\t課程編號(hào):\t\t課程名:")
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? ? ? for i in data:
? ? ? ? ? ? ? ? ? ? ? ? ? ? print(i)
? ? ? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', '\t\t'.join(i))
? ? ? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? ? ? cursor.close
? ? ? ? ? ? ? ? connection = conn()
? ? ? ? ? ? ? ? cursor = cur(connection)
? ? ? ? ? ? ? ? try:
? ? ? ? ? ? ? ? ? ? cursor.execute('select sc.sno,sname,sclass,sc.cno,course.cname from student,course,sc where student.sno=sc.sno and course.cno=sc.cno and sc.sno=%s',(loginingno))
? ? ? ? ? ? ? ? ? ? data = list(cursor.fetchall())
? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "學(xué)號(hào):\t\t姓名:\t\t班級(jí):\t\t課程編號(hào):\t\t課程名:")
? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? ? ? for i in data:
? ? ? ? ? ? ? ? ? ? ? ? print(i)
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', '\t\t'.join(i))
? ? ? ? ? ? ? ? ? ? ? ? textshow.insert('insert', "\n")
? ? ? ? ? ? ? ? except:
? ? ? ? ? ? ? ? ? ? connection.rollback()
? ? ? ? ? ? ? ? ? ? connection.close()
? ? ? ? ? ? ? ? ? ? cursor.close
?
? ? ? ? ? ? def searchallcancel():
? ? ? ? ? ? ? ? textshow.delete('1.0', 'end')
? ? ? ? ? ? findall = Toplevel()
? ? ? ? ? ? findall.title('查詢(xún)選課信息')
? ? ? ? ? ? x, y = window_info(findall)
? ? ? ? ? ? findall.geometry("520x295+%d+%d" % (x, y))
? ? ? ? ? ? findall['bg'] = 'dodgerblue'
? ? ? ? ? ? labelname = tkinter.Label(findall, text='查詢(xún)選課信息?', bg='dodgerblue')
? ? ? ? ? ? labelname.place(x=5, y=20, width=100, height=20)
?
? ? ? ? ? ? buttonshow = tkinter.Button(findall, text="確定", command=show)
? ? ? ? ? ? buttonshow.place(x=5, y=50, width=50, height=20)
?
? ? ? ? ? ? textshow = tkinter.scrolledtext.ScrolledText(findall, width=105, height=9)
? ? ? ? ? ? textshow.place(x=5, y=80)
?
? ? ? ? ? ? buttoncancel = tkinter.Button(findall, text="清空", command=searchallcancel)
? ? ? ? ? ? buttoncancel.place(x=5, y=210, width=50, height=20)
?
? ? ? ? ? ? findall.mainloop()
? ? ? ??
? ? ? ? print(3)
? ? ? ? indexofstudent = Toplevel()
? ? ? ? indexofstudent.title('學(xué)生信息管理系統(tǒng)-學(xué)生')
? ? ? ? x, y = window_info(indexofstudent)
? ? ? ? indexofstudent.geometry("430x425+%d+%d" % (x, y))
? ? ? ? indexofstudent['bg'] = 'dodgerblue'
?
? ? ? ? labelname = tkinter.Label(indexofstudent, text='歡迎使用學(xué)生信息管理系統(tǒng)', bg='dodgerblue', font=("楷體", 20))
? ? ? ? labelname.place(x=60, y=30, width=350, height=40)
?
? ? ? ? buttonadd = tkinter.Button(indexofstudent, text="查詢(xún)學(xué)籍信息", command=showinfor)
? ? ? ? buttonadd.place(x=150, y=90, width=100, height=40)
?
? ? ? ? buttonadd = tkinter.Button(indexofstudent, text="查詢(xún)課程信息", command=findcourseinfor)
? ? ? ? buttonadd.place(x=150, y=140, width=100, height=40)
?
? ? ? ? buttonadd = tkinter.Button(indexofstudent, text="選 ? ?課", command=selectcourse)
? ? ? ? buttonadd.place(x=150, y=190, width=100, height=40)
?
? ? ? ? buttonadd = tkinter.Button(indexofstudent, text="查詢(xún)選課信息", command=findselectcourseinfor)
? ? ? ? buttonadd.place(x=150, y=240, width=100, height=40)
?
? ? ? ? buttonadd = tkinter.Button(indexofstudent, text="退出系統(tǒng)", command=exitsys)
? ? ? ? buttonadd.place(x=150, y=290, width=100, height=40)
?
? ? ? ? indexofstudent.mainloop()
? ? def login():
? ? ? ? name = entryName.get()
? ? ? ? pwd = entryPwd.get()
? ? ? ? connection = conn()
? ? ? ? cursor = cur(connection)
? ? ? ? cursor.execute('select * from student')
? ? ? ? data = list(cursor.fetchall())
? ? ? ? print(data)
? ? ? ? if data == []:
? ? ? ? ? ? tkinter.messagebox.showerror(message="賬號(hào)或密碼錯(cuò)誤!")
? ? ? ? ? ? return 0
? ? ? ? for i in data:
? ? ? ? ? ? print(i[2])
? ? ? ? ? ? print(i[4])
? ? ? ? ? ? if i[2] == name and i[4] == pwd:
? ? ? ? ? ? ? ? studentindex(name)
? ? ? ??
? ? ? ??
? ? student = Toplevel()
? ? student.title(' 登錄-學(xué)生端')
? ? x, y = window_info(student)
? ? student.geometry("415x295+%d+%d" % (x, y))
? ? student['bg'] = 'dodgerblue'
?
? ? labelname = tkinter.Label(student, text='歡迎使用學(xué)生信息管理系統(tǒng)', bg='dodgerblue', font=("楷體", 18))
? ? labelname.place(x=60, y=30, width=300, height=40)
?
? ? labelName = tkinter.Label(student, text="學(xué) ? ?號(hào):", bg='dodgerblue', width=80)
? ? labelName.place(x=110, y=110, width=80, height=20)
? ? labelPwd = tkinter.Label(student, text="密 ? ?碼:", bg='dodgerblue', width=80)
? ? labelPwd.place(x=110, y=135, width=80, height=20)
?
? ? entryName = tkinter.Entry(student, width=80, textvariable=varLoginName)
? ? entryName.place(x=210, y=110, width=80, height=20)
? ? entryPwd = tkinter.Entry(student, show='*', width=80, textvariable=varLoginPwd)
? ? entryPwd.place(x=210, y=135, width=80, height=20)
?
? ? bottonOk = tkinter.Button(student, text="登錄", command=login, bg='dodgerblue')
? ? bottonOk.place(x=125, y=170, width=70, height=30)
? ? bottonCancel = tkinter.Button(student, text='注冊(cè)', command=forstudentregister, bg='dodgerblue')
? ? bottonCancel.place(x=225, y=170, width=70, height=30)
?
? ? student.mainloop()
?
?
?
root=tkinter.Tk(className=' 學(xué)生信息管理系統(tǒng)')
x,y=window_info(root)
root.geometry("415x295+%d+%d"%(x,y))
root['bg']='dodgerblue'
?
varLoginName=tkinter.StringVar()
varLoginPwd=tkinter.StringVar()
?
labelname = tkinter.Label(root, text='歡迎使用學(xué)生信息管理系統(tǒng)', bg='dodgerblue', font=("楷體", 18))
labelname.place(x=60, y=30, width=300, height=40)
?
?
bottonOk=tkinter.Button(root,text="學(xué)生登錄",command=studentlogin,bg='dodgerblue')
bottonOk.place(x=150,y=140,width=100,height=40)
bottonCancel=tkinter.Button(root,text='管理員登錄',command=teacherlogin,bg='dodgerblue')
bottonCancel.place(x=150,y=200,width=100,height=40)
?
def createdatabase():
? ? conn = pymysql.connect("localhost", "root", "root")
? ? cur = conn.cursor()
? ? cur.execute('create database if not exists sch')
?
def createtable():
? ? connection = conn()
? ? cursor = cur(connection)
? ? sqlstudent="""create table if not exists student(
? ? ? ? ? ? ? ? ? ? sname char(45) not null,
? ? ? ? ? ? ? ? ? ? sage char(45),
? ? ? ? ? ? ? ? ? ? sno char(45) primary key,
? ? ? ? ? ? ? ? ? ? sclass char(45),
? ? ? ? ? ? ? ? ? ? loginpwd char(45)
? ? ? ? ? ? ? ? ? ? )engine=innodb"""
? ? cursor.execute(sqlstudent)
? ??
? ??
? ? sqllogin="""create table if not exists login(
? ? ? ? ? ? ? ? ? ? user char(45)primary key,
? ? ? ? ? ? ? ? ? ? password char(45) not null
? ? ? ? ? ? ? ? ? ? )engine=innodb"""
? ? cursor.execute(sqllogin)
? ? connection.commit()
? ? cursor.execute("""insert into login(user,password) values('user','pwd')""")
? ? connection.commit()
? ??
? ? sqlteacher="""create table if not exists teacher(
? ? ? ? ? ? ? ? ? ? tno char(45) primary key,
? ? ? ? ? ? ? ? ? ? tname char(45)?
? ? ? ? ? ? ? ? ? ? )engine=innodb"""
? ? cursor.execute(sqlteacher)
? ? connection.commit()
?
? ? sqlcourse="""create table if not exists course(
? ? ? ? ? ? ? ? ? ? ? ? cno char(45) ,
? ? ? ? ? ? ? ? ? ? ? ? cname char(45),
? ? ? ? ? ? ? ? ? ? ? ? tno char(45),
? ? ? ? ? ? ? ? ? ? ? ? constraint pk_course primary key (cno,tno)
? ? ? ? ? ? ? ? ? ? ? ? )engine=innodb"""
? ? cursor.execute(sqlcourse)
? ? connection.commit()
?
? ? sqlsc="""create table if not exists sc(
? ? ? ? ? ? ? ? ? ? ? ? sno char(45),
? ? ? ? ? ? ? ? ? ? ? ? cno char(45),
? ? ? ? ? ? ? ? ? ? ? ? constraint pk_sc primary key (sno,cno)
? ? ? ? ? ? ? ? ? ? ? ? )engine=innodb"""
? ? cursor.execute(sqlsc)
? ? connection.commit()
?
? ??
createdatabase()
createtable()
?
root.mainloop()

以上就是本文的全部?jī)?nèi)容,希望對(duì)大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。

相關(guān)文章

  • python調(diào)用支付寶支付接口流程

    python調(diào)用支付寶支付接口流程

    這篇文章主要介紹了python調(diào)用支付寶支付接口流程,本文給大家介紹的非常詳細(xì),具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2019-08-08
  • pyinstaller打包可執(zhí)行程序過(guò)程中的常見(jiàn)錯(cuò)誤解決

    pyinstaller打包可執(zhí)行程序過(guò)程中的常見(jiàn)錯(cuò)誤解決

    這篇文章主要介紹了pyinstaller打包可執(zhí)行程序過(guò)程中的常見(jiàn)錯(cuò)誤解決,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2023-11-11
  • Python字符編碼判斷方法分析

    Python字符編碼判斷方法分析

    這篇文章主要介紹了Python字符編碼判斷方法,結(jié)合實(shí)例形式分析了Python字符編碼的判斷技巧,并給出了chardet的安裝與使用方法,需要的朋友可以參考下
    2016-07-07
  • Python和Perl繪制中國(guó)北京跑步地圖的方法

    Python和Perl繪制中國(guó)北京跑步地圖的方法

    當(dāng)你在一個(gè)城市,穿越大街小巷,跑步跑了幾千公里之后,一個(gè)顯而易見(jiàn)的想法是,我到底和之前比快了多少,跑量有何變化,如果能把在這個(gè)城市的所有路線全部畫(huà)出來(lái),會(huì)是怎樣的景象呢,接下來(lái)通過(guò)本文給大家介紹Python和Perl繪制中國(guó)北京跑步地圖的方法,需要的朋友參考下
    2016-03-03
  • 淺談pycharm的xmx和xms設(shè)置方法

    淺談pycharm的xmx和xms設(shè)置方法

    今天小編就為大家分享一篇淺談pycharm的xmx和xms設(shè)置方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過(guò)來(lái)看看吧
    2018-12-12
  • python高效的素?cái)?shù)判斷算法

    python高效的素?cái)?shù)判斷算法

    這篇文章主要介紹了python高效的素?cái)?shù)判斷算法,研究算法的同學(xué)一定要看一下
    2021-04-04
  • python中scipy.stats產(chǎn)生隨機(jī)數(shù)實(shí)例講解

    python中scipy.stats產(chǎn)生隨機(jī)數(shù)實(shí)例講解

    在本篇文章里小編給大家分享的是一篇關(guān)于python中scipy.stats產(chǎn)生隨機(jī)數(shù)實(shí)例講解內(nèi)容,有需要的朋友們可以學(xué)習(xí)下。
    2021-02-02
  • pycharm 如何查看某一函數(shù)源碼的快捷鍵

    pycharm 如何查看某一函數(shù)源碼的快捷鍵

    這篇文章主要介紹了在pycharm中實(shí)現(xiàn)查看某一函數(shù)源碼的快捷鍵,具有很好的參考價(jià)值,希望能給大家做個(gè)參考,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2021-05-05
  • Python for循環(huán)中的陷阱詳解

    Python for循環(huán)中的陷阱詳解

    這篇文章主要給大家介紹了關(guān)于Python for循環(huán)中陷阱的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2018-07-07
  • 淺析Python中的getattr(),setattr(),delattr(),hasattr()

    淺析Python中的getattr(),setattr(),delattr(),hasattr()

    這篇文章主要介紹了Python中的getattr(),setattr(),delattr(),hasattr() 的相關(guān)資料,非常不錯(cuò)具有參考借鑒價(jià)值,需要的朋友可以參考下
    2016-06-06

最新評(píng)論