首页 > 编程语言 >学生管理系统开发mainpage(python语言)

学生管理系统开发mainpage(python语言)

时间:2024-10-08 20:51:43浏览次数:11  
标签:管理系统 python self label stu mainpage place tk Var

主界面与其他界面切换的代码


# 开发者:a_blue_fat
# 日期:2023/11/22
# 时间:8:48

import tkinter as tk
# from view import *
import view
class MainPage:
    def __init__(self, master):
        self.root = master
        self.root.geometry("800x400")
        self.root.title("学生管理系统")
        self.create_widget()
    def create_widget(self):
        self.menubar = tk.Menu(self.root)
        self.root["menu"] = self.menubar
        self.menubar.add_command(label="添加学生信息",command=self.to_add_info)
        self.menubar.add_command(label="查询学生信息",command=self.to_search_info)
        self.menubar.add_command(label="修改学生信息",command=self.to_modify_info)
        self.menubar.add_command(label="删除学生信息",command=self.to_delete_info)
        # 点击不同的菜单按钮会调到不同的frame界面
        self.add_frame =view.AddFrame(self.root)
        self.search_frame = view.SearchFrame(self.root)
        self.modify_frame = view.ModifyFrame(self.root)
        self.delete_frame = view.DeleteFrame(self.root)
        self.add_frame.pack()
    def to_add_info(self):
        self.add_frame.pack()
        self.search_frame.forget()
        self.modify_frame.forget()
        self.delete_frame.forget()
    def to_search_info(self):
        self.add_frame.forget()
        self.search_frame.pack()
        self.modify_frame.forget()
        self.delete_frame.forget()
        self.search_frame.show_message()
    def to_modify_info(self):
        self.add_frame.forget()
        self.search_frame.forget()
        self.modify_frame.pack()
        self.delete_frame.forget()
    def to_delete_info(self):
        self.add_frame.forget()
        self.search_frame.forget()
        self.modify_frame.forget()
        self.delete_frame.pack()
        self.delete_frame.show_message()




if __name__ == '__main__':
    root = tk.Tk()
    MainPage(root)
    root.mainloop()
    pass

主界面GUI设计代码

# 添加
class AddFrame(tk.Frame):
    def __init__(self, master):
        self.master = master
        super().__init__(self.master)
        self.creat_widget()

    def creat_widget(self):
        # 给frame 里添加组件
        self.label = tk.LabelFrame(self, text="添加学生信息", height=300, width=600)
        self.label.pack()
        # 添加学生照片
        self.images = "image/welcome.gif"
        self.photo = Image.open(self.images)
        self.img = self.photo
        self.photo = self.photo.resize((150, 180))
        self.image = ImageTk.PhotoImage(self.photo)
        self.stu_image = tk.Label(self.label, image=self.image)
        self.stu_image_add = tk.Button(self.label, text="点击添加图片", command=self.get_image)
        # 年龄,性别,省,市,县控制控件的值
        self.Var_age = tk.StringVar()
        self.Var_age.set("0")
        self.Var_sex = tk.StringVar()
        self.Var_sex.set("男")
        self.Var_department = tk.StringVar()
        self.Var_department.set("")
        self.Var_county = tk.StringVar()
        self.Var_county.set("")
        self.Var_city = tk.StringVar()
        self.Var_city.set("")
        self.Var_province = tk.StringVar()
        self.Var_province.set("")
        self.Var_text=tk.StringVar()
        self.Var_text.set("请输入详细地址")

        # 系别可供选择的值
        self.out_department = ["信息工程系","机电工程系","管理工程系","旅游系","经济系","商贸系","外语系","艺术系",]
        # 省市县可供选择的值
        self.out_province = ["北京市","天津市","上海市","重庆市","河北省","山西省","辽宁省","吉林省","黑龙江省","江苏省","浙江省","安徽省","福建省","江西省","山东省","河南省","湖北省",
                             "湖南省","广东省","广西壮族自治区","海南省","四川省","贵州省","云南省","西藏自治区","陕西省","甘肃省","青海省","宁夏回族自治区", "新疆维吾尔自治区", "台湾省",]

        self.out_city = ["石家庄市","唐山市","秦皇岛市","邯郸市","邢台市","保定市","张家口市","承德市","沧州市","廊坊市","衡水市"",辛集市", "晋州市", "新乐市", "遵化市", "迁安市", "滦州市","南宫市", "沙河市",
                         "霸州市", "三河市", "武安市", "深州市","平泉市", "泊头市", "任丘市", "黄骅市", "河间市", "涿州市","定州市", "安国市", "高碑店市", "太原市","大同市","阳泉市","长治市","晋城市","朔州市",
                         "晋中市", "运城市","忻州市","临汾市","吕梁市","沈阳市","大连市","鞍山市","抚顺市","本溪市","丹东市","锦州市","营口市","阜新市","辽阳市","盘锦市","铁岭市","朝阳市","葫芦岛市",
                         "长春市","吉林省","四平市","辽源市","通化市","白山市","松原市","白城市","哈尔滨市","齐齐哈尔市","鸡西市","鹤岗市","双鸭山市","大庆市","伊春市","佳木斯市","七台河市","牡丹江市",
                         "黑河市","绥化市","南京市","无锡市","徐州市","常州市","苏州市","南通市","连云港市","淮安市","盐城市","扬州市","镇江市","泰州市","杭州市","宁波市","温州市","嘉兴市","湖州市",
                         "绍兴市","金华市","衢州市","舟山市","台州市","丽水市","宿迁市","合肥市","芜湖市","蚌埠市","淮南市","马鞍山市","淮北市","铜陵市","安庆市","黄山市","阜阳市","宿州市","滁州市",
                         "六安市","宣城市","池州市","亳州市","福州市","厦门市","莆田市","三明市","泉州市","漳州市","南平市","龙岩市","宁德市","南昌市","景德镇市","萍乡市","九江市","抚州市","鹰潭市",
                         "赣州市","吉安市","宜春市","新余市","上饶市","济南市","青岛市","淄博市","枣庄市","东营市","烟台市","潍坊市","济宁市","泰安市","威海市","日照市","临沂市","德州市","聊城市","滨州市",
                         "菏泽市","济南市","青岛市","淄博市","枣庄市","东营市","烟台市","潍坊市","济宁市","泰安市","威海市","日照市","临沂市","德州市","聊城市","滨州市","菏泽市","郑州市","开封市","洛阳市",
                         "平顶山市","安阳市","鹤壁市","新乡市","焦作市","濮阳市","许昌市","漯河市","三门峡市","南阳市","商丘市","信阳市","周口市","驻马店市","武汉市","黄石市","十堰市","宜昌市","襄阳市",
                         "鄂州市","荆门市","孝感市","荆州市","黄冈市","咸宁市","随州市","长沙市","株洲市","湘潭市","衡阳市","邵阳市","岳阳市","常德市","张家界市","益阳市","郴州市","永州市","怀化市","娄底市",
                        "广州市","韶关市","深圳市","珠海市","汕头市","佛山市","江门市","湛江市","茂名市","肇庆市","惠州市","梅州市","汕尾市","河源市","阳江市","清远市","东莞市","中山市","潮州市","揭阳市",
                         "云浮市","南宁市","柳州市","桂林市","梧州市","北海市","防城港市","钦州市","贵港市","玉林市","百色市","贺州市","河池市","来宾市","崇左市","海口市","三亚市","三沙市","儋州市","成都市",
                         "自贡市","攀枝花市","泸州市","德阳市","绵阳市","广元市","遂宁市","内江市","乐山市","南充市","眉山市","宜宾市","广安市","达州市","雅安市","巴中市","资阳市","贵阳市","六盘水市","遵义市",
                         "安顺市","毕节市","铜仁市","昆明市","曲靖市","玉溪市","保山市","昭通市","丽江市","普洱市","临沧市","拉萨市","日喀则市","昌都市","林芝市","山南市","那曲市","西安市","铜川市","宝鸡市",
                         "咸阳市","渭南市","延安市","汉中市","榆林市","安康市","商洛市","兰州市","嘉峪关市","金昌市","白银市","天水市","武威市","张掖市","平凉市","酒泉市","庆阳市","定西市","陇南市","西宁市","海东市",
                         "银川市","石嘴山市","吴忠市","固原市","中卫市","乌鲁木齐市","克拉玛依市","吐鲁番市","哈密市",]

        self.out_county = ["赵县", "行唐县", "灵寿县", "平山县", "井陉县", "元氏县", "高邑县", "无极县", "深泽县", "正定县", "赞皇县", "玉田县", "迁西县", "乐亭县", "滦南县", "昌黎县", "卢龙县", "磁县", "邱县",
                           "魏县", "涉县", "大名县", "成安县", "临漳县", "馆陶县", "广平县", "曲周县", "鸡泽县", "威县", "广宗县", "巨鹿县","临城县", "临西县", "柏乡县", "隆尧县", "清河县",  "内丘县", "宁晋县",
                           "平乡县", "新河县", "雄县", "易县", "唐县", "蠡县", "博野县", "定兴县", "安新县", "涞源县", "阜平县", "高阳县", "涞水县", "望都县", "顺平县", "曲阳县", "容城县", "蔚县", "赤城县",
                           "沽源县", "怀安县", "怀来县", "康保县","涿鹿县", "张北县", "尚义县", "阳原县", "承德县", "兴隆县", "隆化县", "滦平县", "沧县", "青县", "献县", "东光县", "海兴县", "盐山县", "吴桥县",
                           "肃宁县", "南皮县", "文安县", "固安县", "永清县", "大城县", "香河县", "景县", "安平县", "阜城县", "故城县", "枣强县", "武邑县", "武强县", "饶阳县","阳曲县", "娄烦县", "清徐县", "左云县",
                           "阳高县", "天镇县","浑源县", "广灵县", "灵丘县", "盂县", "平定县", "沁县","壶关县", "沁源县", "长子县", "襄垣县", "武乡县", "黎城县","平顺县", "陵川县", "沁水县", "泽州县", "阳城县", "应县",
                           "右玉县", "山阴县", "祁县", "灵石县", "榆社县", "左权县","和顺县","昔阳县", "平遥县", "寿阳县", "夏县", "绛县","临猗县", "芮城县", "万荣县", "新绛县", "垣曲县", "稷山县","闻喜县", "平陆县",
                           "代县", "保德县", "定襄县", "五台县","河曲县", "繁峙县", "偏关县", "宁武县", "静乐县", "神池县","五寨县", "岢岚县", "古县", "蒲县", "吉县", "隰县","襄汾县", "洪洞县", "安泽县","曲沃县",
                           "浮山县", "翼城县","乡宁县", "汾西县", "永和县", "大宁县", "岚县", "兴县","临县", "交城县", "文水县", "方山县", "交口县", "柳林县","中阳县", "石楼县","武川县", "托克托县", "清水河县",
                           "和林格尔县","固阳县", "林西县", "宁城县", "开鲁县", "五原县", "磴口县","卓资县", "化德县", "商都县", "兴和县","凉城县", "突泉县","多伦县","法库县", "康平县", "长海县", "台安县", "抚顺县",
                           "黑山县", "义县", "彰武县", "辽阳县", "盘山县", "铁岭县", "昌图县","西丰县", "朝阳县", "建平县", "绥中县", "建昌县","农安县", "永吉县", "梨树县", "东丰县", "东辽县", "通化县","辉南县", "柳河县",
                           "抚松县", "靖宇县", "镇赉县", "通榆县","乾安县", "长岭县", "汪清县", "安图县","宾县", "巴彦县", "方正县", "依兰县", "通河县", "延寿县", "木兰县", "龙江县", "富裕县", "克东县", "克山县", "泰来县",
                           "甘南县", "拜泉县", "依安县", "林口县", "桦川县", "桦南县", "汤原县", "肇源县", "肇州县", "林甸县", "嘉荫县","南岔县", "汤旺县", "丰林县", "大箐山县", "鸡东县", "萝北县", "绥滨县", "集贤县",
                           "宝清县", "友谊县", "饶河县", "勃利县", "望奎县", "兰西县", "青冈县", "绥棱县", "明水县", "庆安县", "孙吴县", "逊克县", "呼玛县", "塔河县", "丰县", "沛县", "睢宁县", "如东县", "灌云县", "灌南县","东海县",
                           "涟水县", "金湖县", "盱眙县", "响水县", "滨海县","阜宁县", "射阳县", "建湖县", "宝应县", "沭阳县", "泗洪县","泗阳县","桐庐县", "淳安县", "象山县", "宁海县", "苍南县", "永嘉县","平阳县", "泰顺县", "文成县",
                           "新昌县", "德清县", "安吉县","长兴县", "海盐县", "嘉善县", "浦江县", "武义县", "磐安县","常山县", "开化县", "龙游县", "天台县", "三门县", "仙居县","缙云县", "青田县", "遂昌县", "松阳县", "庆元县", "云和县",
                           "岱山县", "嵊泗县","肥西县", "肥东县", "长丰县", "庐江县", "南陵县", "五河县", "固镇县", "怀远县", "凤台县", "寿县", "含山县", "和县", "当涂县", "濉溪县", "枞阳县", "怀宁县", "岳西县", "太湖县", "宿松县",
                           "望江县", "歙县", "休宁县", "黟县", "祁门县", "颍上县", "临泉县", "阜南县", "太和县", "萧县", "砀山县", "灵璧县", "泗县", "全椒县", "来安县", "定远县", "凤阳县", "霍邱县", "霍山县", "金寨县", "舒城县",
                           "郎溪县", "泾县", "绩溪县", "旌德县", "青阳县", "石台县", "东至县", "蒙城县", "涡阳县", "利辛县","闽侯县", "连江县", "罗源县", "闽清县", "永泰县", "平潭县", "仙游县", "清流县", "宁化县", "大田县", "尤溪县",
                           "明溪县", "建宁县", "将乐县", "泰宁县", "惠安县", "安溪县", "永春县", "德化县", "金门县", "云霄县", "漳浦县", "诏安县", "东山县", "华安县", "南靖县", "平和县", "顺昌县", "浦城县", "光泽县", "松溪县", "政和县",
                           "长汀县", "上杭县", "武平县", "连城县", "霞浦县", "古田县", "屏南县", "寿宁县", "周宁县", "柘荣县","南昌县", "安义县", "进贤县", "永修县", "德安县", "都昌县湖口县", "彭泽县", "修水县", "武宁县", "婺源县",
                           "玉山县铅山县", "横峰县", "弋阳县", "万年县", "余干县", "鄱阳县","南城县", "黎川县", "南丰县", "崇仁县", "乐安县", "广昌县宜黄县", "金溪县", "资溪县", "奉新县", "万载县", "上高县宜丰县", "靖安县", "铜鼓县", "吉安县",
                           "吉水县", "新干县永丰县", "泰和县", "峡江县", "遂川县", "万安县", "安福县", "永新县", "信丰县", "大余县", "定南县", "全南县", "崇义县", "寻乌县", "安远县", "宁都县", "于都县", "会昌县", "兴国县", "石城县", "上犹县",
                           "莲花县", "上栗县", "芦溪县", "浮梁县", "分宜县","阴县", "商河县", "桓台县", "高青县", "沂源县", "广饶县", "利津县", "临朐县", "昌乐县", "嘉祥县", "汶上县", "梁山县", "微山县", "鱼台县", "金乡县", "泗水县", "宁阳县",
                           "东平县", "五莲县", "莒县", "惠民县", "阳信县", "无棣县" "博兴县" "临邑县" "平原县","夏津县", "武城县", "庆云县", "宁津县", "齐河县", "阳谷县", "东阿县", "高唐县", "冠县", "莘县", "兰陵县", "郯城县", "莒南县", "沂水县",
                           "蒙阴县", "平邑县", "沂南县", "临沭县", "费县", "曹县", "单县", "巨野县", "成武县", "郓城县", "鄄城县", "东明县","中牟县", "兰考县", "尉氏县", "通许县", "杞县", "嵩县","新安县", "洛宁县", "宜阳县", "栾川县", "伊川县",
                           "汝阳县", "鲁山县", "宝丰县", "叶县", "郏县", "安阳县", "汤阴县", "内黄县", "滑县", "浚县", "淇县", "新乡县", "获嘉县", "原阳县","延津县", "封丘县", "修武县", "博爱县", "武陟县", "温县", "清丰县", "濮阳县", "南乐县",
                           "台前县", "范县", "鄢陵县", "襄城县", "舞阳县", "临颍县", "渑池县", "卢氏县", "睢县", "宁陵县", "柘城县", "虞城县", "夏邑县", "民权县", "扶沟县","西华县", "商水县", "沈丘县", "鹿邑县", "太康县", "郸城县", "西平县",
                           "上蔡县", "新蔡县", "正阳县", "泌阳县", "遂平县", "确山县", "汝南县", "平舆县", "南召县", "西峡县", "方城县", "镇平县", "内乡县," "桐柏县", "淅川县", "社旗县","唐河县", "新野县", "新县", "息县", "潢川县", "固始县",
                           "淮滨县", "罗山县", "商城县", "光山县", "阳新县", "郧西县", "竹山县", "竹溪县", "房县", "公安县", "江陵县", "远安县", "兴山县", "秭归县", "南漳县", "谷城县", "保康县", "沙洋县", "团风县", "红安县", "罗田县", "英山县",
                           "浠水县", "蕲春县", "黄梅县", "孝昌县", "大悟县", "云梦县", "嘉鱼县", "通城县", "崇阳县", "通山县", "建始县", "巴东县", "咸丰县", "宣恩县", "来凤县", "鹤峰县", "随县","长沙县", "攸县", "炎陵县", "茶陵县", "湘潭县",
                           "祁东县","衡东县", "衡南县", "衡阳县", "衡山县", "绥宁县","新邵县", "邵阳县", "隆回县", "洞口县", "华容县", "岳阳县","平江县", "湘阴县", "澧县", "安乡县"," 汉寿县", "石门县","临澧县", "桃源县", "桑植县", "慈利县", "南县",
                           "安化县", "桃江县", "新化县", "双峰县", "桂东县", "安仁县", "桂阳县","永兴县", "宜章县", "嘉禾县", "汝城县", "临武县", "道县","新田县", "东安县", "双牌县", "江永县", "蓝山县", "宁远县","会同县", "中方县", "沅陵县", "辰溪县",
                           "溆浦县", "龙山县", "泸溪县", "凤凰县", "花垣县", "保靖县", "古丈县", "永顺县", "新丰县", "始兴县", "仁化县", "翁源县", "东源县", "连平县","和平县", "紫金县", "龙川县", "丰顺县", "五华县", "平远县","蕉岭县", "大埔县", "龙门县",
                           "博罗县", "惠东县", "徐闻县","遂溪县", "新兴县", "郁南县", "佛冈县", "阳山县", "阳西县","海丰县", "陆河县", "南澳县", "德庆县", "广宁县", "封开县","隆安县", "马山县", "上林县", "宾阳县", "柳城县", "鹿寨县","融安县", "阳朔县",
                           "灵川县", "全州县", "平乐县", "兴安县","灌阳县", "永福县", "资源县", "苍梧县", "蒙山县", "藤县","合浦县", "上思县", "灵山县", "浦北县", "平南县", "容县","陆川县", "博白县", "兴业县", "西林县", "田东县", "德保县","那坡县", "凌云县",
                           "乐业县", "田林县", "昭平县", "钟山县","南丹县", "天峨县", "凤山县", "东兰县", "象州县", "武宣县","忻城县", "扶绥县", "宁明县", "龙州县", "大新县", "天等县","定安县", "屯昌县", "澄迈县", "临高县", "城口县", "丰都县", "垫江县", "忠县",
                           "云阳县", "奉节县", "巫山县", "巫溪县",

                           ]








        # 添加学生学号

        self.Var_id = tk.StringVar()
        self.Var_id.set("此行自动生成")
        self.stu_idl = tk.Label(self.label, text="学号:")
        self.stu_id = tk.Label(self.label, textvariable=self.Var_id, relief="ridge", bg="white")
        # 添加学生姓名
        self.stu_namel = tk.Label(self.label, text="姓名:")
        self.stu_name = tk.Entry(self.label)



        # 添加学生年龄
        self.stu_agel = tk.Label(self.label, text="年龄")
        self.stu_age = tk.Entry(self.label, textvariable=self.Var_age, width=2)
        # 添加性别
        self.stu_genderl = tk.Label(self.label, text="性别:")
        self.stu_gender_l = tk.Radiobutton(self.label, text="男", variable=self.Var_sex, value="男")
        self.stu_gender_r = tk.Radiobutton(self.label, text="女", variable=self.Var_sex, value="女")
        # 添加联系方式
        self.stu_tell = tk.Label(self.label, text="电话:")
        self.stu_tel = tk.Entry(self.label)
        # 添加系别
        self.stu_departmentl = tk.Label(self.label, text="系别:")
        self.stu_department = tk.OptionMenu(self.label,self.Var_department, *self.out_department)
        # 添加班级
        self.stu_classl = tk.Label(self.label, text="班级:")
        self.stu_class = tk.Entry(self.label)
        # 添加地址省市县
        self.stu_adl1 = tk.Label(self.label, text="地址:")
        self.stu_provincel = tk.Label(self.label, text="省", anchor="w")
        self.stu_province = tk.OptionMenu(self.label,self.Var_province, *self.out_province)

        self.stu_cityl = tk.Label(self.label, text="市", anchor="e")
        self.stu_city = tk.OptionMenu(self.label, self.Var_city, *self.out_city)
        self.stu_countyl = tk.Label(self.label, text="县", anchor="w")
        self.stu_county = tk.OptionMenu(self.label, self.Var_county, *self.out_county)
        # 添加地址
        self.a = 0
        self.stu_adl = tk.Label(self.label, text="地址:")
        self.stu_ad = tk.Entry(self.label, width=15, textvariable=self.Var_text)


        # 确认添加信息按钮

        self.addbtn = tk.Button(self, text="点击确认添加信息", command=self.add_massage)
        # 进行grid布局
        self.stu_image.place(x=10, y=10)
        self.stu_image_add.place(x=40, y=210)
        self.stu_namel.place(x=180, y=20)
        self.stu_name.place(x=220, y=20, width=120)
        self.stu_idl.place(x=320-10+50, y=20)
        self.stu_id.place(x=360-10+50, y=20, width=120)
        self.stu_agel.place(x=180, y=60)
        self.stu_age.place(x=220, y=60, width=120)
        self.stu_genderl.place(x=320-10+50, y=60)
        self.stu_gender_l.place(x=360-10+50, y=60)
        self.stu_gender_r.place(x=360+90, y=60)
        self.stu_departmentl.place(x=180, y=100)
        self.stu_department.place(x=220, y=100, width=120, height=27)
        self.stu_classl.place(x=320-10+50, y=100)
        self.stu_class.place(x=360-10+50, y=100, width=120)
        self.stu_tell.place(x=180, y=140)
        self.stu_tel.place(x=220, y=140, width=120)
        self.stu_adl1.place(x=180, y=180)
        self.stu_province.place(x=220, y=180, width=70, height=30)
        self.stu_provincel.place(x=290, y=180)
        self.stu_city.place(x=320, y=180, width=70, height=30)
        self.stu_cityl.place(x=390, y=180)
        self.stu_county.place(x=420, y=180, width=70, height=30)
        self.stu_countyl.place(x=490, y=180)
        self.stu_ad.place(x=220, y=220, width=300)
        # 进行pack布局
        self.addbtn.pack(side="right", pady=10)

实现获取学生图片并展示到对应label框的自定义函数

先进行预加载图片,转换成可以展示在label框中的数据,再通过config修改label框内imge的参数实现在人机交互界面显示出学生的图片。

    def get_image(self):
        global file_name
        file_name = file.askopenfilename(filetypes=[("jpg图片", "jpg"),("gif图片", "gif")],
                                         initialdir="D:/pythonlearn/")
        print(file_name)
        if file_name == None:
            file_name = "image/welcome.gif"
        print(file_name)
        try:
            self.photo = Image.open(file_name)

            self.img = self.photo
        except Exception as re:
            file_name = "image/welcome.gif"
        self.photo = self.photo.resize((150, 180))
        self.image = ImageTk.PhotoImage(self.photo)
        self.stu_image.config(image=self.image)

实现学生信息内容保存和学生图片保存的自定义函数

通过将获取到的学生所有信息整合成字典保存到对应的json文件中,注意这种保存方法并未加密,想要加密后保存需在保存前执行加密代码加密内容后再保存,使信息更加安全的被保存。

保存图片是加载到对应的路径,当然这种保存也是不安全的,可以在保存到对应路径前写一个加密代码实现加密保存。

    def add_massage(self):
        if self.stu_name.get() == "":
            messagebox.showerror("错误", "没有获取用户名字")
        else:
            self.students_list = []
            with open("static/stu_info.json", "r", encoding="utf-8") as f:
                self.students_list = json.load(f)
            print(self.stu_name.get())

            self.Var_id.set(str(int(self.students_list[len(self.students_list)-1]["id"])+1))

            stu_massage = [{"id": str(int(self.students_list[len(self.students_list)-1]["id"])+1),
                            "name": self.stu_name.get(),
                            "age": self.Var_age.get(),
                            "gender": self.Var_sex.get(), "mobile": self.stu_tel.get(), "address": self.stu_ad.get(),
                            "province": self.Var_province.get(), "city": self.Var_city.get(),
                            "county": self.Var_county.get(),
                            "class": self.stu_class.get(), "department": self.Var_department.get()}]
            self.students_list.extend(stu_massage)
            data.save_data(self.students_list)
            messagebox.showinfo("提示", "添加成功")
            # print(self.Var_year.get()+self.Var_mouth.get()+self.Var_day.get())
            # os.listdir()
            # 保存学生图片到指定路径
            save_out = "D:\\pythonlearn\\stusys_new\\stu_image\\"
            out_name = str(int(self.students_list[len(self.students_list)-1]["id"]))
            save_path = save_out + out_name + '.gif'
            self.img.save(save_path)
            pass

标签:管理系统,python,self,label,stu,mainpage,place,tk,Var
From: https://blog.csdn.net/2301_80120329/article/details/142769196

相关文章

  • jsp宠物店管理系统95gkg(程序+源码+数据库+调试部署+开发环境)
    本系统(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。系统程序文件列表用户,商品分类,宠物商店,服务分类,宠物服务,服务订单,宠物信息,宠物类别,宠物订单,服务登记技术要求: 开发语言:JSP前端使用:HTML5,CSS,JSP动态网页技术后端使......
  • jsp城市智慧停车场管理系统pd2hk(程序+源码+数据库+调试部署+开发环境)
    本系统(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。系统程序文件列表车位信息,停车场,车辆信息,普通管理员开题报告内容一、课题背景及意义随着城市化进程的加速,停车难问题日益突出,成为制约城市发展的重要瓶颈。传统停车场管理方......
  • 基于django+vue+Vue防疫物资仓库管理系统【开题报告+程序+论文】-计算机毕设
    本系统(程序+源码+数据库+调试部署+开发环境)带论文文档1万字以上,文末可获取,系统界面在最后面。系统程序文件列表开题报告内容研究背景在全球新冠疫情持续蔓延的背景下,防疫物资的有效管理和分配成为了公共卫生应急响应中的关键环节。随着疫情形势的不断变化,各类防疫物资如口......
  • springboot+vue【开题+程序+论文】基于javaweb的校友管理系统
    系统程序文件列表开题报告内容研究背景随着信息技术的迅猛发展和互联网的广泛普及,校友管理成为了各高校和校友会工作的重要组成部分。传统的校友管理方式,如纸质档案、电话沟通、邮件联络等,已难以满足当前高效、便捷、互动的管理需求。特别是在全球范围内,校友分布广泛,信息更......
  • java计算机毕业设计共享自习室管理系统(开题+程序+论文)
    本系统(程序+源码)带文档lw万字以上 文末可获取一份本项目的java源码和数据库参考。系统程序文件列表开题报告内容研究背景在当今社会,随着教育资源的日益紧张和终身学习理念的深入人心,共享自习室作为一种新兴的学习空间形式,受到了越来越多学生的青睐。共享自习室不仅为学生......
  • Python Kivy 应用的进阶学习教程
    文章目录Kivy应用的进阶学习教程目录1.使用Buildozer打包Android应用1.1环境准备1.2创建基本Kivy应用1.3安装和配置Buildozer1.4打包Android应用1.5部署到Android设备2.打包iOS应用的基本步骤2.1MacOS开发环境2.2使用Xcode和Kivy2.3打包iO......
  • Python Kivy 完整应用开发:待办事项列表
    文章目录Kivy完整应用开发:待办事项列表1.项目概述2.环境准备3.界面设计3.1界面布局示例:实现界面布局4.实现功能4.1添加待办事项功能4.2显示待办事项示例:更新待办事项显示4.3删除待办事项功能示例:实现删除功能4.4标记待办事项为完成示例:实现复选框5.整合......
  • Python学习的自我理解和想法(5)
    学的是b站的课程(黑马程序员),跟老师写程序,不是自创的代码!今天是学Python的第五天,学的内容是还是列表。1.列表元素的排序(1).sort()语法:list.sort(),[对原列表中的元素进行排序,默认是升序,不会生成一个新列表,若想实现降序排列,转入参数reverse=True].(2)sorted()语法:list.sort......
  • Python面向对象基础
    文章目录1.什么是面向对象1.1常见的编程思想1.2面向过程是什么1.3什么是面向对象1.4封装1.5继承1.6多态2.面向对象的概念2.1两个重要概念:类和对象2.2类2.3对象2.4self关键字3.对象属性3.1什么是属性3.2类外面访问属性3.3类内部获取属性1.什么是面......
  • 【新人系列】Python 入门(一):介绍及环境搭建
    ✍个人博客:https://blog.csdn.net/Newin2020?type=blog......