首页 星云 工具 资源 星选 资讯 热门工具
:

PDF转图片 完全免费 小红书视频下载 无水印 抖音视频下载 无水印 数字星空

Python校园学生一卡通管理

信息化管理 283.41KB 16 需要积分: 1
立即下载

资源介绍:

Python校园学生一卡通管理
import sqlite3 from tkinter import * from tkinter import ttk, messagebox import time win = Tk() win.title('登录') screenwidth = win.winfo_screenwidth() screenheight = win.winfo_screenheight() size = '%dx%d+%d+%d' % (400, 400, (screenwidth - 400) / 2, (screenheight - 400) / 2) win.geometry(size) win.resizable(False, False) # 登录**页面布局 lab1 = Label(win, text='一卡通管理系统登录', font='微软雅黑 15').place(x=120, y=30) frame1 = Frame(win, height=200, width=300, bd=1, relief='sunken') frame1.place(x=50, y=90) lab_username = Label(frame1, text='用户名:', font='微软雅黑 12').place(x=40, y=40) entry_username = Entry(frame1, width=20) entry_username.place(x=110, y=45) lab_passwd = Label(frame1, text='密 码:', font='微软雅黑 12').place(x=40, y=80) entry_passwd = Entry(frame1, width=20, show='*') entry_passwd.place(x=110, y=85) lab4 = Label(frame1, text='选择登录类型:', font='微软雅黑 12').place(x=40, y=120) combo4 = ttk.Combobox(frame1, width=10, height=20, values=('学生','教职工', '管理员'), state="readonly") combo4.place(x=150, y=120, ) combo4.current(0) # 默认值 btn1 = ttk.Button(win, text='登录') btn1.place(x=80, y=320) btn2 = ttk.Button(win, text='取消', command=lambda: win.quit()) btn2.place(x=240, y=320) # 创建表 try: conn = sqlite3.connect('ykt.db') conn.execute('''CREATE TABLE USER (ID CHAR(13) PRIMARY KEY NOT NULL , PASSWD TEXT, TYPE TEXT)''') conn.execute('''CREATE TABLE USERINFO (ID CHAR(13) PRIMARY KEY NOT NULL , NAME TEXT, SEX BOOLEAN, banji CHAR(11), major CHAR(50))''') conn.execute('''CREATE TABLE CDINFO (ID CHAR(13) PRIMARY KEY NOT NULL, MONEY FLOAT , LOCK BOOLEAN)''') conn.execute('''CREATE TABLE HISTORY (ID CHAR(13) , NAME text TIME TEXT, MONEY FLOAT, BANJI text, ZHUANYE text)''') messagebox.showinfo('欢迎使用', '初始化成功!') conn.close() except: pass conn = sqlite3.connect('ykt.db') varmoney = StringVar() infoID = StringVar() sexSelect = StringVar() peopleSelect = StringVar() time1 = time.strftime('%Y-%m-%d %H:%M:%S', time.localtime(time.time())) def check_lock(ID): cursor = conn.execute('SELECT lock from CDINFO where ID= "' + ID + '"') temp = cursor.fetchall() if temp[0][0] == 1: messagebox.showinfo('提示', '此一卡通已锁定') return False else: return True def doSql(sql): '''用来执行SQL语句,尤其是INSERT和DELETE语句''' conn = sqlite3.connect('ykt.db') cur = conn.cursor() cur.execute(sql) conn.commit() conn.close() # 登录**函数定义 def login(event): def infoWin(): '''详细信息——窗口''' global infoID, sexSelect winInfo = Toplevel() sizeWinInfo = '%dx%d+%d+%d' % (500, 500, (screenwidth - 500) / 2, (screenheight - 500) / 2) winInfo.geometry(sizeWinInfo) winInfo.title('详细信息') winInfo.attributes("-toolwindow", 1) # 新窗口在最上面 lab11InfoID = Label(winInfo, text='卡号', font='微软雅黑 12', fg='blue').place(x=140, y=10) lab12InfoID = Label(winInfo, textvariable=infoID, font='微软雅黑 12', fg='blue').place(x=220, y=10) lab2InfoName = Label(winInfo, text='姓名', font='微软雅黑 12').place(x=140, y=60) entryInfoName = Entry(winInfo, width=20) entryInfoName.place(x=220, y=62) lab3InfoName = Label(winInfo, text='性别', font='微软雅黑 12').place(x=140, y=140) comboInfoSex = ttk.Combobox(winInfo, width=5, height=20, textvariable=sexSelect, values=('男', '女'), state="readonly") comboInfoSex.place(x=220, y=142) sexSelect.set('男') lab41InfoNum = Label(winInfo, text='班级', font='微软雅黑 12').place(x=140, y=220) entryInfoNum = Entry(winInfo, width=20) entryInfoNum.place(x=220, y=222) lab5Infomajor = Label(winInfo, text='专业', font='微软雅黑 12').place(x=140, y=300) entryInfomajor = Entry(winInfo, width=20) entryInfomajor.place(x=220, y=302) btn1Info = ttk.Button(winInfo, text='确定', width=15) btn1Info.place(x=100, y=400) btn2Info = ttk.Button(winInfo, text='清除', width=15) btn2Info.place(x=300, y=400) cursor = conn.execute('select * from USERINFO where ID = "' + infoID.get() + '"') temp = cursor.fetchall()[0] entryInfoName.insert(0, temp[1]) sexSelect.set(temp[2]) entryInfoNum.insert(0, temp[3]) entryInfomajor.insert(0, temp[4]) def check(event): ID = infoID.get() name = entryInfoName.get() sex = comboInfoSex.get() banji = entryInfoNum.get() major = entryInfomajor.get() if name == '': messagebox.showerror('错误', '姓名不能为空') return if banji != '': if len(banji) != 1: messagebox.showerror('错误', '请输入正确班级号') return ask = messagebox.askyesnocancel('注意', '是否保存修改?') if ask == True: sql = 'update USERINFO set name = "' + name + '", sex = "' sql += sex + '", banji = "' + banji + '",zhuanye ="' + major + '"' doSql(sql) winInfo.destroy() messagebox.showinfo('恭喜', '修改成功!') elif ask == False: winInfo.destroy() else: pass def clear(event): entryInfoName.delete(0, END) entryInfoNum.delete(0, END) entryInfomajor.delete(0, END) comboInfoSex.current(0) btn1Info.bind('', check) btn2Info.bind('', clear) def jianMoneyWin(): '''消费——窗口''' global entry1jianMoney, ID winjianMoney = Toplevel() sizeWinjianMoney = '%dx%d+%d+%d' % (400, 250, (screenwidth - 400) / 2, (screenheight - 250) / 2) winjianMoney.geometry(sizeWinjianMoney) winjianMoney.title('消费') winjianMoney.attributes("-toolwindow", 1) # 新窗口在最上面 framejianMoney = Frame(winjianMoney, height=200, width=340, bd=1, relief='sunken') framejianMoney.place(x=30, y=30) lab1jianMoney = Label(framejianMoney, text='消费金额:', font='微软雅黑 12').place(x=50, y=30) entry1jianMoney = Entry(framejianMoney, width=20) entry1jianMoney.place(x=130, y=32) btn1jianMoney = ttk.Button(framejianMoney, text='确认') btn1jianMoney.place(x=40, y=150) btn2jianMoney = ttk.Button(framejianMoney, text='清除') btn2jianMoney.place(x=200, y=150) def clear(event): entry1jianMoney.delete(0, END) def jian(event): cursor = conn.execute('select money from CDINFO where ID = "' + ID + '"') temp = cursor.fetchall() money1 = temp[0][0] sql1 = 'update CDINFO set money = "' + str( money1 - float(entry1jianMoney.get())) + '" where ID = "' + ID + '"' temp='消费'+entry1jianMoney.get()+'元' sql2 = 'insert into HISTORY values("' + ID + '","' + time1 + '","' + temp + '")' doSql(sql1) doSql(sql2) cursor = conn.execute('select money from CDINFO where ID = "' + ID + '"'

资源文件列表:

基于python的校园一卡通管理系统.zip 大约有3个文件
  1. 基于python的校园一卡通管理系统/
  2. 基于python的校园一卡通管理系统/基于Python的校园学生一卡通管理系统 任务书及课程报告.docx 278.67KB
  3. 基于python的校园一卡通管理系统/课设.py 31.1KB
0评论
提交 加载更多评论
其他资源 vs2017+cmake 编译完成的libtiff+proj+sqlite3+libgeotiff 库文件和头文件
vs2017+cmake 编译完成的libtiff+proj+sqlite3+libgeotiff 库文件和头文件
masm5.0-dosbox0.74-MasmForWindows.zip
masm5.0 dosbox0.74 masm for windows.rar
masm5.0-dosbox0.74-MasmForWindows.zip masm5.0-dosbox0.74-MasmForWindows.zip
EXE一机一码打包加密大师1.5.0 (解压密码1234)
EXE一机一码打包加密大师最新版1.5.0, 支持网络验证, 给EXE添加卡密. EXE一机一码打包加密大师是一款功能强大的工具,用于保护和加密EXE文件。支持一机一码离线加密, 一机一码网络验证加密, 支持给EXE添加卡密, 添加授权信息等, 方便制作加密EXE文件. 1.5.0最新版本新增了网络验证功能, 并修复了一些问题, 使得加密EXE更加稳定, 保护效果更佳.
1(2) (2) (2).zip
1(2) (2) (2).zip
优化后的ListView(自定义Adapter).zip
优化后的ListView(自定义Adapter).zip
研旭DSP28335代码
研旭DSP28335代码
木头UI纹理按钮边框 背景图标 带PNG素材:Wooden UI 1.0
资源包包含以下元素:按钮、图标、框架、复选框等,提供分层的 PSD 文件。
attendanceManagement.zip
attendanceManagement.zip