Python+MySQL+Tkinter设计学生信息管理系统(速成)

Python+tkinter+Mysql实现登录注册修改密码 解决:之前将root.mainloop写在了组件之前 把它放到最后的位置,添加self.destroy|()之后,点击忘记密码还是会有之前的窗口出现。,Toplevel 组件是一个独立的顶级窗口,这种窗口通常拥有标题栏、边框等部件,和 Tk() 创建出来的根窗口是一样的,共享着一样的方法。使用了tk.Tk()方法来新建窗口,这样得到的是一个新的。,无法与原来的根窗口进行有效交互,所以需要使用。 阅读详情

前言

最近Python课堂上布置了综合实训,实验目标是设计一个学生信息管理系统,笔者对GUI界面早有些兴趣,在查找一番资料后总结出基于Python语言要实现学生信息管理系统的两大法宝----MySQL&Tkiner,下面就让我简单复盘一下程序设计的全流程

MySQL部分

MySQL下载以及配置

建议去网上找找教程,这里我贴了连接以后审核不通过QAQ

照着教程安装后还需要下载pymysql的包,在终端cmd输入pip install pymysql即可

在配置过程中我们时不时会出现一些小问题,这里我找到了一篇个人认为比较好的解决方案

MySQL基本学习

为了能够快速入门MySQL,我们可以直接上手敲代码来加快学习速度,可以去b站找找那个38min的教学视频

数据库的学习

在创建数据库的时候我用了Navicat来进行图形化的数据库创建,进一步加快学习效率,同时方便调试程序时查看表内数据,安装连接可以去网上找找

学习连接可以自行查找

数据库的创建

打开界面后我们要新建一个连接,名称任意,设置好自己的一些配置信息,第一次使用的话默认即可,然后点击下方的测试连接测试数据库的连接是否正常

7bca40ec345a4b6daddc45aefec3f72e.png

正常显示如下

7d89383f501d4fd484bbef82811a5bbe.png

 接下来就可以生成各项表,在这里我根据作业要求生成了两个表,一个是管理员表MANAGER,一个是学生表STUDENT

8602a276c43d4759bc80a641b8849d71.png

具体数据内容如下

管理员包含name和code两个信息即可 

179526e3f4fa4020b1e9fd160304db33.png

学生则包含ID、姓名以及若干成绩

9759b2bc63fa4a569a15b9942366075d.png这样一个基本的数据库我们就创建好了 

GUI学习

Tkinter是Python自带的GUI编程包,因此无需下载

Tkinter学习

入门的话看这一篇即可

Python-GUI界面设计(tkinter)_梦之海岛的博客-优快云博客_python窗口界面设计

代码介绍

连接数据库

这里我们将先前在图形化界面创建好的数据对应上即可,这样就连接完成了

#!/usr/bin/python3

from tkinter import *
from tkinter import messagebox
from PIL import Image,ImageTk
import tkinter
import pymysql
from tkinter import ttk

# 打开数据库连接
def Sql_link():
    #生成数据库
    db = pymysql.connect(host='localhost',user='root',password='321',database='testdb')
    # 使用 cursor() 方法创建一个游标对象
    cursor = db.cursor()
    return db,cursor

管理员注册

·利用Tk()创建窗口对象并配置

·定义好关联变量,这样在后期将数据输入Entry文本框时才是能够传输给数据库的变量

·创建按钮对象,回调函数中对数据库进行操作

·合理放置标签,文本框,按钮对象

·回调函数中,先利用SELECT * FROM **** WHERE **** 判断是否存在相同ID,不同的话则利用   get()接收要写入的内容

·利用INSERT **** VALUES **** 给数据赋值

#管理员注册
def create_manager():
    #创建窗口
    create_manager_root = Tk()
    create_manager_root.title("管理员用户创建")
    create_manager_root.config(width=600)
    create_manager_root.config(height=600)
    #定义关联变量
    manager_name = StringVar(create_manager_root, value='')
    manager_code = StringVar(create_manager_root, value='')
    #提示性标签
    labelmanager_name = Label(create_manager_root, text="管理员ID注册", font=("微软雅黑 -20"))
    labelmanager_code = Label(create_manager_root, text="管理员密码设置", font=("微软雅黑 -20"))
    #设定标签位置
    labelmanager_name.place(x=200, y=100, height=40, width=200)
    labelmanager_code.place(x=200, y=200, height=40, width=200)
    #定义录入信息文本框,以关联变量形式存储
    entrymanager_name = Entry((create_manager_root), textvariable=manager_name)
    entrymanager_name.place(x=200, y=150, height=40, width=200)
    entrymanager_code = Entry((create_manager_root), textvariable=manager_code)
    entrymanager_code.place(x=200, y=250, height=40, width=200)
    #录入信息回调函数
    def Button_Ok():
        #设置标志位判断是否存在ID重复
        flag = 0
        #连接数据库
        db, cur = Sql_link()
        #将得到的StringVar对象传值回来
        data_manager_name = str(entrymanager_name.get())
        data_manager_code = str(entrymanager_code.get())
        #判断是否ID重复
        search = cur.execute("SELECT * FROM manager WHERE name =  " + data_manager_name + ';')
        if(search > 0):
            flag = 1
        else:
            flag = 0
        if(flag==0):
            try:
                #写入数据
                sql1 = "INSERT INTO manager(name,code)"
                sql1 += "VALUES('%s','%s')"%(data_manager_name,data_manager_code)
                cur.execute(sql1)
                db.commit()
                messagebox.showinfo(title="恭喜",message="注册成功!!!")
                create_manager_root.destroy()
            except:
                messagebox.showerror(message="注册失败!!!")
        else:
              messagebox.showerror("该用户名已注册!!!")
    #确认以及退出按钮
    Ok_Button = Button(create_manager_root,text="确认",font=("微软雅黑 -20"),command=Button_Ok)
    Exit_Button = Button(create_manager_root, text="退出", font=("微软雅黑 -20"), command=create_manager_root.destroy)
    Ok_Button.place(x=75, y=350, height=40, width=200)
    Exit_Button.place(x=325, y=350, height=40, width=200)

管理员登录

和上面区别不大,这里用到的MySQL语句还是WHERE *** AND *** 用于判断ID和密码是否能够对应的上

#管理员登录
def load_manager():
    # 创建窗口
    load_manager_root = Tk()
    load_manager_root.title("管理员用户创建")
    load_manager_root.config(width=600)
    load_manager_root.config(height=600)
    # 定义关联变量
    manager_name = StringVar(load_manager_root, value='')
    manager_code = StringVar(load_manager_root, value='')
    # 提示性标签
    labelmanager_name = Label(load_manager_root, text="管理员ID", font=("微软雅黑 -20"))
    labelmanager_code = Label(load_manager_root, text="管理员密码", font=("微软雅黑 -20"))
    # 设定标签位置
    labelmanager_name.place(x=200, y=100, height=40, width=200)
    labelmanager_code.place(x=200, y=200, height=40, width=200)
    # 定义录入信息文本框,以关联变量形式存储
    entrymanager_name = Entry((load_manager_root), textvariable=manager_name)
    entrymanager_name.place(x=200, y=150, height=40, width=200)
    entrymanager_code = Entry((load_manager_root), textvariable=manager_code)
    entrymanager_code.place(x=200, y=250, height=40, width=200)
    def Button_Ok():
        #连接数据库
        db,cur = Sql_link()
        # 将得到的StringVar对象传值回来
        data_manager_name = str(entrymanager_name.get())
        data_manager_code = str(entrymanager_code.get())
        sql = "SELECT * FROM manager WHERE name=%s AND code='%s'"%(data_manager_name,data_manager_code)
        search = cur.execute(sql)
        if(search>0):
            messagebox.showinfo(title="恭喜",message="登录成功!!!")
            show_student()
            load_manager_root.destroy()
        else:
            messagebox.showerror(message="该账号不存在!")
    Ok_Button = Button(load_manager_root, text="确认", font=("微软雅黑 -20"), command=Button_Ok)
    Exit_Button = Button(load_manager_root, text="退出", font=("微软雅黑 -20"), command=load_manager_root.destroy)
    Ok_Button.place(x=75, y=350, height=40, width=200)
    Exit_Button.place(x=325, y=350, height=40, width=200)

管理员信息修改

这里信息修改分为两个小模块,一个是账号删除,一个是修改密码,前者直接用DELETE命令

后者用UPDATE命令

#管理员信息修改
def change_manager():
    # 创建窗口
    change_manager_root = Tk()
    change_manager_root.title("管理员信息修改")
    change_manager_root.config(width=600)
    change_manager_root.config(height=600)
    #删除信息
    def delete_manager():
        #创建窗口
        delete_manager_root = Tk()
        delete_manager_root.title("管理员信息删除")
        delete_manager_root.config(width=600)
        delete_manager_root.config(height=600)

        manager_name = StringVar(delete_manager_root, value='')
        # 提示性标签
        labelmanager_name = Label(delete_manager_root, text="要删除的管理员ID", font=("微软雅黑 -20"))
        entrymanager_name = Entry(delete_manager_root, textvariable=manager_name)

        labelmanager_name.place(x=200, y=100, height=40, width=200)
        entrymanager_name.place(x=200, y=200, height=40, width=200)

        def Button_Ok():
            db,cur = Sql_link()
            manager_name = eval(entrymanager_name.get())
            #查找对应的ID号
            sql = "SELECT * FROM manager WHERE name = %s"%(manager_name)
            search = cur.execute(sql)
            if(search>0):
                messagebox.showinfo(message="删除成功!")
                #删除目标行
                sql1 = "DELETE FROM manager WHERE name = %s"%(manager_name)
                cur.execute(sql1)
                db.commit()
            else:
                messagebox.showerror(message="该用户不存在!")
        Ok_Button = Button(delete_manager_root, text="确认", font=("微软雅黑 -20"),command=Button_Ok)
        Exit_Button = Button(delete_manager_root, text="退出", font=("微软雅黑 -20"), command=delete_manager_root.destroy)
        Ok_Button.place(x=75, y=350, height=40, width=200)
        Exit_Button.place(x=325, y=350, height=40, width=200)
    #修改密码
    def change_code():
        #创建窗口
        change_code_root = Tk()
        change_code_root.title("管理员信息删除")
        change_code_root.config(width=600)
        change_code_root.config(height=600)

        manager_name = StringVar(change_code_root, value='')
        old_manager_code = StringVar(change_code_root, value='')

        # 提示性标签
        labelmanager_name = Label(change_code_root, text="要修改的管理员ID", font=("微软雅黑 -20"))
        entrymanager_name = Entry(change_code_root, textvariable=manager_name)
        labelold_manager_code = Label(change_code_root, text="请输入原密码", font=("微软雅黑 -20"))
        entryold_manager_code = Entry(change_code_root, textvariable=old_manager_code)

        labelmanager_name.place(x=200, y=50, height=40, width=200)
        entrymanager_name.place(x=200, y=150, height=40, width=200)
        labelold_manager_code.place(x=200, y=250, height=40, width=200)
        entryold_manager_code.place(x=200, y=350, height=40, width=200)

        def Button_Ok():
            db,cur = Sql_link()
            manager_name = eval(entrymanager_name.get())
            #匹配对应的ID
            sql = "SELECT * FROM manager WHERE name = %s"%(manager_name)
            search = cur.execute(sql)
            if(search>0):
                #创建新窗口
                input_code_root = Tk()
                input_code_root.title("管理员密码修改")
                input_code_root.config(width=600)
                input_code_root.config(height=600)
                #设置关联变量
                new_manager_code = StringVar(input_code_root, value='')
                labelnew_manager_code = Label(input_code_root, text="新的密码", font=("微软雅黑 -20"))
                entrynew_manager_code = Entry(input_code_root, textvariable=new_manager_code)
                #设置提示性标签
                labelnew_manager_code.place(x=200, y=200, height=40, width=200)
                entrynew_manager_code.place(x=200, y=300, height=40, width=200)
                def Button_Ok():
                    try:
                        new_manager_code = entrynew_manager_code.get()
                        messagebox.showinfo(message="修改成功!")
                        #利用UPDATE来修改密码
                        sql1 = "UPDATE manager SET code = %s WHERE name = %s" % (new_manager_code,manager_name)
                        cur.execute(sql1)
                        db.commit()
                    except:
                        messagebox.showerror(message="修改失败!")
                Ok_Button = Button(input_code_root, text="确认", font=("微软雅黑 -20"), command=Button_Ok)
                Exit_Button = Button(input_code_root, text="退出", font=("微软雅黑 -20"), command=input_code_root.destroy)
                Ok_Button.place(x=75, y=350, height=40, width=200)
                Exit_Button.place(x=325, y=350, height=40, width=200)

            else:
                messagebox.showerror(message="该用户不存在!")
        Ok_Button = Button(change_code_root, text="确认", font=("微软雅黑 -20"),command=Button_Ok)
        Exit_Button = Button(change_code_root, text="退出", font=("微软雅黑 -20"), command=change_code_root.destroy)
        Ok_Button.place(x=75, y=450, height=40, width=200)
        Exit_Button.place(x=325, y=450, height=40, width=200)
    # 设置按钮
    button_stu1 = Button(change_manager_root, text="删除账号", font=("微软雅黑 -20"),command=delete_manager)
    button_stu2 = Button(change_manager_root, text="修改密码", font=("微软雅黑 -20"),command=change_code)
    button_stu1.place(x=200, y=100, height=40, width=200)
    button_stu2.place(x=200, y=200, height=40, width=200)

    Exit_Button = Button(change_manager_root, text="退出", font=("微软雅黑 -20"), command=change_manager_root.destroy)
    Exit_Button.place(x=200, y=300, height=40, width=200)

展示学生信息页面

先初始化好展示学生信息的界面

def show_student():
    #创建窗口
    show_student_root = Tk()
    show_student_root.title("录入学生信息")
    show_student_root.config(width=600)
    show_student_root.config(height=600)

#设置按钮
    button_stu1 = Button(show_student_root, text="录入成绩信息", font=("微软雅黑 -20"),command=input_grade)
    button_stu2 = Button(show_student_root, text="查询成绩信息", font=("微软雅黑 -20"),command=search_grade)
    button_stu3 = Button(show_student_root, text="删除成绩信息", font=("微软雅黑 -20"),command=delete_data)
    button_stu4 = Button(show_student_root, text="分科成绩排序", font=("微软雅黑 -20"),command=sort_one_grade)
    button_stu5 = Button(show_student_root, text="总科成绩排序", font=("微软雅黑 -20"),command=sort_all_grade)
    button_stu1.place(x=200, y=30, height=40, width=200)
    button_stu2.place(x=200, y=130, height=40, width=200)
    button_stu3.place(x=200, y=230, height=40, width=200)
    button_stu4.place(x=200, y=330, height=40, width=200)
    button_stu5.place(x=200, y=430, height=40, width=200)

    Exit_Button = Button(show_student_root, text="退出", font=("微软雅黑 -20"), command=show_student_root.destroy)
    Exit_Button.place(x=200, y=530, height=40, width=200)

录入成绩信息

这里继续通过INSERT插入信息,同时利用加法将总分求出来

#输入信息
    def input_grade():
        input_grade_root = Tk()
        input_grade_root.title("学生成绩录入")
        input_grade_root.config(width=600)
        input_grade_root.config(height=900)
        # 定义关联变量
        student_id = StringVar(input_grade_root, value='')
        student_name = StringVar(input_grade_root, value='')
        math_grade = StringVar(input_grade_root, value='')
        python_grade = StringVar(input_grade_root, value='')
        modian_grade = StringVar(input_grade_root, value='')
        shudian_grade = StringVar(input_grade_root, value='')
        # 提示性标签
        labelstudent_id = Label(input_grade_root, text="学生ID", font=("微软雅黑 -20"))
        labelstudent_name = Label(input_grade_root, text="学生姓名", font=("微软雅黑 -20"))
        labelmath_grade = Label(input_grade_root, text="数学成绩", font=("微软雅黑 -20"))
        labelpython_grade = Label(input_grade_root, text="Python成绩", font=("微软雅黑 -20"))
        labelmodian_grade = Label(input_grade_root, text="模电成绩", font=("微软雅黑 -20"))
        labelshudian_grade = Label(input_grade_root, text="数电成绩", font=("微软雅黑 -20"))
        # 设定标签位置
        labelstudent_id.place(x=200, y=50, height=40, width=200)
        labelstudent_name.place(x=200, y=150, height=40, width=200)
        labelmath_grade.place(x=200, y=250, height=40, width=200)
        labelpython_grade.place(x=200, y=350, height=40, width=200)
        labelmodian_grade.place(x=200, y=450, height=40, width=200)
        labelshudian_grade.place(x=200, y=550, height=40, width=200)
        # 定义录入信息文本框,以关联变量形式存储
        entrystudent_id = Entry(input_grade_root, textvariable=student_id)
        entrystudent_id.place(x=200, y=100, height=40, width=200)
        entrystudent_name = Entry(input_grade_root, textvariable=student_name)
        entrystudent_name.place(x=200, y=200, height=40, width=200)
        entrymath_grade = Entry(input_grade_root, textvariable=math_grade)
        entrymath_grade.place(x=200, y=300, height=40, width=200)
        entrypython_grade = Entry(input_grade_root, textvariable=python_grade)
        entrypython_grade.place(x=200, y=400, height=40, width=200)
        entrymodian_grade = Entry(input_grade_root, textvariable=modian_grade)
        entrymodian_grade.place(x=200, y=500, height=40, width=200)
        entryshudian_grade = Entry(input_grade_root, textvariable=shudian_grade)
        entryshudian_grade.place(x=200, y=600, height=40, width=200)
        # 确认以及退出按钮
        def Button_Ok():
            #注意数据类型转换
            db,cur = Sql_link()
            student_id = eval(entrystudent_id.get())
            student_name = entrystudent_name.get()
            math_grade = eval(entrymath_grade.get())
            python_grade = eval(entrypython_grade.get())
            modian_grade = eval(entrymodian_grade.get())
            shudian_grade = eval(entryshudian_grade.get())
            try:
                #这里总分通过求和得到结果
                sql = "INSERT INTO student(ID,NAME,数学成绩,Python成绩,模电成绩,数电成绩,总分)"
                sql += "VALUES(%d,'%s',%.2f,%.2f,%.2f,%.2f,%.2f)"%(
                    student_id,student_name,math_grade,python_grade,modian_grade,
                    shudian_grade,math_grade+python_grade+modian_grade+shudian_grade)
                cur.execute(sql)
                db.commit()
                messagebox.showinfo(message="录入信息成功!")
            except:
                messagebox.showerror(message="录入信息失败!请检查是否有ID重复")
        Ok_Button = Button(input_grade_root, text="确认", font=("微软雅黑 -20"), command=Button_Ok)
        Exit_Button = Button(input_grade_root, text="退出", font=("微软雅黑 -20"), command=input_grade_root.destroy)
        Ok_Button.place(x=75, y=700, height=40, width=200)
        Exit_Button.place(x=325, y=700, height=40, width=200)

学生信息查询

        def Button_Ok():
            show_student_message_root = Tk()
            show_student_message_root.title("学生信息查询")
            show_student_message_root.config(width=600)
            show_student_message_root.config(height=700)
            #创建关联变量
            student_name = StringVar(show_student_message_root, value='')
            math_grade = StringVar(show_student_message_root, value='')
            python_grade = StringVar(show_student_message_root, value='')
            modian_grade = StringVar(show_student_message_root, value='')
            shudian_grade = StringVar(show_student_message_root, value='')
            db,cur = Sql_link()
            student_id = eval(entrystudent_id.get())
            #查找ID对应的学生
            sql = "SELECT * FROM student WHERE ID = %d"%(student_id)
            num = cur.execute(sql)
            if(num>0):
                cursor = cur.fetchall()
                for row in cursor:
                    if(student_id==row[0]):
                        student_name1 = row[1]
                        math_grade1 = row[2]
                        python_grade1 = row[3]
                        modian_grade1 = row[4]
                        shudian_grade1 = row[5]
                student_name.set(student_name1)
                math_grade.set(math_grade1)
                python_grade.set(python_grade1)
                modian_grade.set(modian_grade1)
                shudian_grade.set(shudian_grade1)
                # 提示性标签
                labelstudent_name = Label(show_student_message_root, text="学生姓名", font=("微软雅黑 -20"))
                labelmath_grade = Label(show_student_message_root, text="数学成绩", font=("微软雅黑 -20"))
                labelpython_grade = Label(show_student_message_root, text="Python成绩", font=("微软雅黑 -20"))
                labelmodian_grade = Label(show_student_message_root, text="模电成绩", font=("微软雅黑 -20"))
                labelshudian_grade = Label(show_student_message_root, text="数电成绩", font=("微软雅黑 -20"))
                # 设定标签位置
                labelstudent_name.place(x=200, y=100, height=40, width=200)
                labelmath_grade.place(x=200, y=200, height=40, width=200)
                labelpython_grade.place(x=200, y=300, height=40, width=200)
                labelmodian_grade.place(x=200, y=400, height=40, width=200)
                labelshudian_grade.place(x=200, y=500, height=40, width=200)
                #配置文本框数据
                entrystudent_name = Entry((show_student_message_root), textvariable=student_name)
                entrystudent_name.place(x=200, y=150, height=40, width=200)
                entrymath_grade = Entry((show_student_message_root), textvariable=math_grade)
                entrymath_grade.place(x=200, y=250, height=40, width=200)
                entrypython_grade = Entry((show_student_message_root), textvariable=python_grade)
                entrypython_grade.place(x=200, y=350, height=40, width=200)
                entrymodian_grade = Entry((show_student_message_root), textvariable=modian_grade)
                entrymodian_grade.place(x=200, y=450, height=40, width=200)
                entryshudian_grade = Entry((show_student_message_root), textvariable=shudian_grade)
                entryshudian_grade.place(x=200, y=550, height=40, width=200)

                Exit_Button = Button(show_student_message_root, text="退出", font=("微软雅黑 -20"), command=show_student_message_root.destroy)
                Exit_Button.place(x=200, y=630, height=40, width=200)
            else:
                messagebox.showerror(message="改用户不存在!")

        Ok_Button = Button(search_grade_root, text="确认", font=("微软雅黑 -20"), command=Button_Ok)
        Exit_Button = Button(search_grade_root, text="退出", font=("微软雅黑 -20"), command=search_grade_root.destroy)
        Ok_Button.place(x=75, y=350, height=40, width=200)
        Exit_Button.place(x=325, y=350, height=40, width=200)

学生信息删除

#删除信息
    def delete_data():
        delete_data_root = Tk()
        delete_data_root.title("学生成绩删除")
        delete_data_root.config(width=600)
        delete_data_root.config(height=600)
        # 定义关联变量
        student_id = StringVar(delete_data_root, value='')
        # 提示性标签
        labelstudent_id = Label(delete_data_root, text="学生ID", font=("微软雅黑 -20"))
        # 设定标签位置
        labelstudent_id.place(x=200, y=150, height=40, width=200)
        # 定义录入信息文本框,以关联变量形式存储
        entrystudent_id = Entry(delete_data_root, textvariable=student_id)
        entrystudent_id.place(x=200, y=200, height=40, width=200)
        def Button_Ok():
            db,cur = Sql_link()
            student_id = eval(entrystudent_id.get())
            sql = "DELETE FROM student WHERE ID = %d"%(student_id)
            try:
                cur.execute(sql)
                db.commit()
                messagebox.showinfo(message="删除成功!")
            except:
                messagebox.showerror(message="删除失败!")
        Ok_Button = Button(delete_data_root, text="确认", font=("微软雅黑 -20"), command=Button_Ok)
        Exit_Button = Button(delete_data_root, text="退出", font=("微软雅黑 -20"), command=delete_data_root.destroy)
        Ok_Button.place(x=75, y=300, height=40, width=200)
        Exit_Button.place(x=325, y=300, height=40, width=200)

单科成绩排序

·这里要用到树来进行大量数据的展示,第一个参数是父根对象,然后是数据的数量,再之后是列的名称,后面可以改,当show为'tree headings'时,树对象会显示表头信息,为其他时不显示

·然后我们通过ORDER命令来进行数据的排序

#单科排序
    def sort_one_grade():
        sort_one_grade_root = Tk()
        sort_one_grade_root.title("单科成绩排序")
        sort_one_grade_root.config(width=600)
        sort_one_grade_root.config(height=600)
        #回调函数
        def math_sort():
            sort_all_grade_root = Tk()
            sort_all_grade_root.title("数学成绩排序")
            sort_all_grade_root.config(width=600)
            sort_all_grade_root.config(height=600)
            #创建树对象用于展示数据
            sort_one_grade_tree = ttk.Treeview(sort_all_grade_root, height=30,
                                               columns=['1', '2', '3', '4', '5', '6', '7'],
                                               show='tree headings')
            sort_one_grade_tree.column('1', width=100, anchor='center')
            sort_one_grade_tree.column('2', width=100, anchor='center')
            sort_one_grade_tree.column('3', width=100, anchor='center')
            sort_one_grade_tree.column('4', width=100, anchor='center')
            sort_one_grade_tree.column('5', width=100, anchor='center')
            sort_one_grade_tree.column('6', width=100, anchor='center')
            sort_one_grade_tree.column('7', width=100, anchor='center')
            #设置树的表头
            sort_one_grade_tree.heading('1', text='ID')
            sort_one_grade_tree.heading('2', text='NAME')
            sort_one_grade_tree.heading('3', text='数学成绩')
            sort_one_grade_tree.heading('4', text='Python成绩')
            sort_one_grade_tree.heading('5', text='模电成绩')
            sort_one_grade_tree.heading('6', text='数电成绩')
            sort_one_grade_tree.heading('7', text='总分')
            try:
                db, cur = Sql_link()
                #逆向排序
                sql = "SELECT * FROM student ORDER BY 数学成绩 DESC"
                cur.execute(sql)
                db.commit()
                # 给树各项参数赋值,若为NONE值则break
                for i in range(0, 30):
                    results = cur.fetchone()
                    while (results):
                        sort_one_grade_tree.insert('', i, values=results)
                        break
            except:
                messagebox.showerror(message="排序失败!")
            sort_one_grade_tree.pack()

            Exit_Button = Button(sort_all_grade_root, text="退出", font=("微软雅黑 -20"), command=sort_all_grade_root.destroy)
            Exit_Button.place(x=350, y=530, height=40, width=200)
        def Python_sort():
            sort_all_grade_root = Tk()
            sort_all_grade_root.title("Python成绩排序")
            sort_all_grade_root.config(width=600)
            sort_all_grade_root.config(height=600)
            # 创建树对象用于展示数据
            sort_one_grade_tree = ttk.Treeview(sort_all_grade_root, height=30,
                                               columns=['1', '2', '3', '4', '5', '6', '7'],
                                               show='tree headings')
            sort_one_grade_tree.column('1', width=100, anchor='center')
            sort_one_grade_tree.column('2', width=100, anchor='center')
            sort_one_grade_tree.column('3', width=100, anchor='center')
            sort_one_grade_tree.column('4', width=100, anchor='center')
            sort_one_grade_tree.column('5', width=100, anchor='center')
            sort_one_grade_tree.column('6', width=100, anchor='center')
            sort_one_grade_tree.column('7', width=100, anchor='center')
            # 设置树的表头
            sort_one_grade_tree.heading('1', text='ID')
            sort_one_grade_tree.heading('2', text='NAME')
            sort_one_grade_tree.heading('3', text='数学成绩')
            sort_one_grade_tree.heading('4', text='Python成绩')
            sort_one_grade_tree.heading('5', text='模电成绩')
            sort_one_grade_tree.heading('6', text='数电成绩')
            sort_one_grade_tree.heading('7', text='总分')
            try:
                db, cur = Sql_link()
                sql = "SELECT * FROM student ORDER BY Python成绩 DESC"
                cur.execute(sql)
                db.commit()
                # 给树各项参数赋值,若为NONE值则break
                for i in range(0, 30):
                    results = cur.fetchone()
                    while (results):
                        sort_one_grade_tree.insert('', i, values=results)
                        break
            except:
                messagebox.showerror(message="排序失败!")
            sort_one_grade_tree.pack()

            Exit_Button = Button(sort_all_grade_root, text="退出", font=("微软雅黑 -20"), command=sort_all_grade_root.destroy)
            Exit_Button.place(x=350, y=530, height=40, width=200)
        def modian_sort():
            sort_all_grade_root = Tk()
            sort_all_grade_root.title("模电成绩排序")
            sort_all_grade_root.config(width=600)
            sort_all_grade_root.config(height=600)
            # 创建树对象用于展示数据
            sort_one_grade_tree = ttk.Treeview(sort_all_grade_root, height=30,
                                               columns=['1', '2', '3', '4', '5', '6', '7'],
                                               show='tree headings')
            sort_one_grade_tree.column('1', width=100, anchor='center')
            sort_one_grade_tree.column('2', width=100, anchor='center')
            sort_one_grade_tree.column('3', width=100, anchor='center')
            sort_one_grade_tree.column('4', width=100, anchor='center')
            sort_one_grade_tree.column('5', width=100, anchor='center')
            sort_one_grade_tree.column('6', width=100, anchor='center')
            sort_one_grade_tree.column('7', width=100, anchor='center')
            # 设置树的表头
            sort_one_grade_tree.heading('1', text='ID')
            sort_one_grade_tree.heading('2', text='NAME')
            sort_one_grade_tree.heading('3', text='数学成绩')
            sort_one_grade_tree.heading('4', text='Python成绩')
            sort_one_grade_tree.heading('5', text='模电成绩')
            sort_one_grade_tree.heading('6', text='数电成绩')
            sort_one_grade_tree.heading('7', text='总分')
            try:
                db, cur = Sql_link()
                sql = "SELECT * FROM student ORDER BY 模电成绩 DESC"
                cur.execute(sql)
                db.commit()
                # 给树各项参数赋值,若为NONE值则break
                for i in range(0, 30):
                    results = cur.fetchone()
                    while (results):
                        sort_one_grade_tree.insert('', i, values=results)
                        break
            except:
                messagebox.showerror(message="排序失败!")
            sort_one_grade_tree.pack()
        
            Exit_Button = Button(sort_all_grade_root, text="退出", font=("微软雅黑 -20"), command=sort_all_grade_root.destroy)
            Exit_Button.place(x=350, y=530, height=40, width=200)
        def shudian_sort():
            sort_all_grade_root = Tk()
            sort_all_grade_root.title("数电成绩排序")
            sort_all_grade_root.config(width=600)
            sort_all_grade_root.config(height=600)
            # 创建树对象用于展示数据
            sort_one_grade_tree = ttk.Treeview(sort_all_grade_root, height=30,
                                               columns=['1', '2', '3', '4', '5', '6', '7'],
                                               show='tree headings')
            sort_one_grade_tree.column('1', width=100, anchor='center')
            sort_one_grade_tree.column('2', width=100, anchor='center')
            sort_one_grade_tree.column('3', width=100, anchor='center')
            sort_one_grade_tree.column('4', width=100, anchor='center')
            sort_one_grade_tree.column('5', width=100, anchor='center')
            sort_one_grade_tree.column('6', width=100, anchor='center')
            sort_one_grade_tree.column('7', width=100, anchor='center')
            # 设置树的表头
            sort_one_grade_tree.heading('1', text='ID')
            sort_one_grade_tree.heading('2', text='NAME')
            sort_one_grade_tree.heading('3', text='数学成绩')
            sort_one_grade_tree.heading('4', text='Python成绩')
            sort_one_grade_tree.heading('5', text='模电成绩')
            sort_one_grade_tree.heading('6', text='数电成绩')
            sort_one_grade_tree.heading('7', text='总分')
            try:
                db, cur = Sql_link()
                sql = "SELECT * FROM student ORDER BY 数电成绩 DESC"
                cur.execute(sql)
                db.commit()
                # 给树各项参数赋值,若为NONE值则break
                for i in range(0, 30):
                    results = cur.fetchone()
                    while (results):
                        sort_one_grade_tree.insert('', i, values=results)
                        break
            except:
                messagebox.showerror(message="排序失败!")
            sort_one_grade_tree.pack()

            Exit_Button = Button(sort_all_grade_root, text="退出", font=("微软雅黑 -20"), command=sort_all_grade_root.destroy)
            Exit_Button.place(x=350, y=530, height=40, width=200)
        math_sort_button = Button(sort_one_grade_root,text="数学排序", font=("微软雅黑 -20"), command=math_sort)
        Python_sort_button = Button(sort_one_grade_root, text="Python排序", font=("微软雅黑 -20"), command=Python_sort)
        modian_sort_button = Button(sort_one_grade_root, text="模电排序", font=("微软雅黑 -20"), command=modian_sort)
        shudian_sort_button = Button(sort_one_grade_root, text="数电排序", font=("微软雅黑 -20"), command=shudian_sort)

        math_sort_button.place(x=200, y=100, height=40, width=200)
        Python_sort_button.place(x=200, y=200, height=40, width=200)
        modian_sort_button.place(x=200, y=300, height=40, width=200)
        shudian_sort_button.place(x=200, y=400, height=40, width=200)

        Exit_Button = Button(sort_one_grade_root, text="退出", font=("微软雅黑 -20"), command=sort_one_grade_root.destroy)
        Exit_Button.place(x=200, y=500, height=40, width=200)

总分成绩排序

#总分排序
    def sort_all_grade():
        sort_all_grade_root = Tk()
        sort_all_grade_root.title("全科成绩排序")
        sort_all_grade_root.config(width=600)
        sort_all_grade_root.config(height=600)
        # 创建树对象用于展示数据
        sort_one_grade_tree = ttk.Treeview(sort_all_grade_root, height=30, columns=['1', '2', '3', '4', '5', '6', '7'],
                                           show='tree headings')
        sort_one_grade_tree.column('1', width=100, anchor='center')
        sort_one_grade_tree.column('2', width=100, anchor='center')
        sort_one_grade_tree.column('3', width=100, anchor='center')
        sort_one_grade_tree.column('4', width=100, anchor='center')
        sort_one_grade_tree.column('5', width=100, anchor='center')
        sort_one_grade_tree.column('6', width=100, anchor='center')
        sort_one_grade_tree.column('7', width=100, anchor='center')
        # 设置树的表头
        sort_one_grade_tree.heading('1', text='ID')
        sort_one_grade_tree.heading('2', text='NAME')
        sort_one_grade_tree.heading('3', text='数学成绩')
        sort_one_grade_tree.heading('4', text='Python成绩')
        sort_one_grade_tree.heading('5', text='模电成绩')
        sort_one_grade_tree.heading('6', text='数电成绩')
        sort_one_grade_tree.heading('7', text='总分')
        try:
            db,cur = Sql_link()
            sql = "SELECT * FROM student ORDER BY 总分 DESC"
            cur.execute(sql)
            db.commit()
            #给树各项参数赋值,若为NONE值则break
            for i in range(0,30):
                results = cur.fetchone()
                while(results):
                    sort_one_grade_tree.insert('',i,values=results)
                    break
        except:
            messagebox.showerror(message="排序失败!")
        sort_one_grade_tree.pack()

        Exit_Button = Button(sort_all_grade_root, text="退出", font=("微软雅黑 -20"), command=sort_all_grade_root.destroy)
        Exit_Button.place(x=350, y=530, height=40, width=200)

主界面展示

#设置登录界面
root = Tk()
# 禁止最大化按钮(只显示最小化按钮和关闭按钮)
root.resizable(False,False)
root.minsize(600,600) # 最小尺寸
root.maxsize(600,600) # 最大尺寸
root.title("学生信息管理系统")
#设置长宽
root.config(width=600)
root.config(height=600)
# 添加窗口背景图片
canvas = tkinter.Canvas(root,
                        width = 600,  # 指定Canvas组件的宽度
                        height = 600,  # 指定Canvas组件的高度
                        bg = 'white'  # 指定Canvas组件的背景色
                        )
#添加背景图片
image = Image.open('D:\\1.jpg')

im = ImageTk.PhotoImage(image) #用photoImage打开图片
canvas.create_image(200, 170, image=im)  # 使用creat_image将图片添加到Canvas
canvas.pack()#初始化画布完成

main_button1=Button(root,text="管理员用户创建",font=("微软雅黑 -20"),command=create_manager)
main_button2=Button(root,text="管理员密码登录",font=("微软雅黑 -20"),command=load_manager)
main_button3=Button(root,text="管理员信息修改",font=("微软雅黑 -20"),command=change_manager)
main_button1.place(x=200,y=100,height=40,width=200)
main_button2.place(x=200,y=200,height=40,width=200)
main_button3.place(x=200,y=300,height=40,width=200)

Exit_Button = Button(root, text="退出", font=("微软雅黑 -20"), command=root.destroy)
Exit_Button.place(x=200, y=400, height=40, width=200)

root.mainloop()

实验演示

经测试没有任何问题,欢迎读者来和我反馈,毕竟这只是一个速成,感觉我能学到的还有很多QAQ

7af00428f7734cf0af9f0600f1bdb9e8.png

源码

#!/usr/bin/python3

from tkinter import *
from tkinter import messagebox
from PIL import Image,ImageTk
import tkinter
import pymysql
from tkinter import ttk

# 打开数据库连接
def Sql_link():
    #生成数据库
    db = pymysql.connect(host='localhost',user='root',password='321',database='testdb')
    # 使用 cursor() 方法创建一个游标对象
    cursor = db.cursor()
    return db,cursor
#管理员注册
def create_manager():
    #创建窗口
    create_manager_root = Tk()
    create_manager_root.title("管理员用户创建")
    create_manager_root.config(width=600)
    create_manager_root.config(height=600)
    #定义关联变量
    manager_name = StringVar(create_manager_root, value='')
    manager_code = StringVar(create_manager_root, value='')
    #提示性标签
    labelmanager_name = Label(create_manager_root, text="管理员ID注册", font=("微软雅黑 -20"))
    labelmanager_code = Label(create_manager_root, text="管理员密码设置", font=("微软雅黑 -20"))
    #设定标签位置
    labelmanager_name.place(x=200, y=100, height=40, width=200)
    labelmanager_code.place(x=200, y=200, height=40, width=200)
    #定义录入信息文本框,以关联变量形式存储
    entrymanager_name = Entry((create_manager_root), textvariable=manager_name)
    entrymanager_name.place(x=200, y=150, height=40, width=200)
    entrymanager_code = Entry((create_manager_root), textvariable=manager_code)
    entrymanager_code.place(x=200, y=250, height=40, width=200)
    #录入信息回调函数
    def Button_Ok():
        #设置标志位判断是否存在ID重复
        flag = 0
        #连接数据库
        db, cur = Sql_link()
        #将得到的StringVar对象传值回来
        data_manager_name = str(entrymanager_name.get())
        data_manager_code = str(entrymanager_code.get())
        #判断是否ID重复
        search = cur.execute("SELECT * FROM manager WHERE name =  " + data_manager_name + ';')
        if(search > 0):
            flag = 1
        else:
            flag = 0
        if(flag==0):
            try:
                #写入数据
                sql1 = "INSERT INTO manager(name,code)"
                sql1 += "VALUES('%s','%s')"%(data_manager_name,data_manager_code)
                cur.execute(sql1)
                db.commit()
                messagebox.showinfo(title="恭喜",message="注册成功!!!")
                create_manager_root.destroy()
            except:
                messagebox.showerror(message="注册失败!!!")
        else:
              messagebox.showerror("该用户名已注册!!!")
    #确认以及退出按钮
    Ok_Button = Button(create_manager_root,text="确认",font=("微软雅黑 -20"),command=Button_Ok)
    Exit_Button = Button(create_manager_root, text="退出", font=("微软雅黑 -20"), command=create_manager_root.destroy)
    Ok_Button.place(x=75, y=350, height=40, width=200)
    Exit_Button.place(x=325, y=350, height=40, width=200)
#管理员登录
def load_manager():
    # 创建窗口
    load_manager_root = Tk()
    load_manager_root.title("管理员用户创建")
    load_manager_root.config(width=600)
    load_manager_root.config(height=600)
    # 定义关联变量
    manager_name = StringVar(load_manager_root, value='')
    manager_code = StringVar(load_manager_root, value='')
    # 提示性标签
    labelmanager_name = Label(load_manager_root, text="管理员ID", font=("微软雅黑 -20"))
    labelmanager_code = Label(load_manager_root, text="管理员密码", font=("微软雅黑 -20"))
    # 设定标签位置
    labelmanager_name.place(x=200, y=100, height=40, width=200)
    labelmanager_code.place(x=200, y=200, height=40, width=200)
    # 定义录入信息文本框,以关联变量形式存储
    entrymanager_name = Entry((load_manager_root), textvariable=manager_name)
    entrymanager_name.place(x=200, y=150, height=40, width=200)
    entrymanager_code = Entry((load_manager_root), textvariable=manager_code)
    entrymanager_code.place(x=200, y=250, height=40, width=200)
    def Button_Ok():
        #连接数据库
        db,cur = Sql_link()
        # 将得到的StringVar对象传值回来
        data_manager_name = str(entrymanager_name.get())
        data_manager_code = str(entrymanager_code.get())
        #判断ID与密码是否能够匹配上
        sql = "SELECT * FROM manager WHERE name=%s AND code='%s'"%(data_manager_name,data_manager_code)
        search = cur.execute(sql)
        if(search>0):
            messagebox.showinfo(title="恭喜",message="登录成功!!!")
            show_student()
            load_manager_root.destroy()
        else:
            messagebox.showerror(message="该账号不存在!")
    Ok_Button = Button(load_manager_root, text="确认", font=("微软雅黑 -20"), command=Button_Ok)
    Exit_Button = Button(load_manager_root, text="退出", font=("微软雅黑 -20"), command=load_manager_root.destroy)
    Ok_Button.place(x=75, y=350, height=40, width=200)
    Exit_Button.place(x=325, y=350, height=40, width=200)
#管理员信息修改
def change_manager():
    # 创建窗口
    change_manager_root = Tk()
    change_manager_root.title("管理员信息修改")
    change_manager_root.config(width=600)
    change_manager_root.config(height=600)
    #删除信息
    def delete_manager():
        #创建窗口
        delete_manager_root = Tk()
        delete_manager_root.title("管理员信息删除")
        delete_manager_root.config(width=600)
        delete_manager_root.config(height=600)

        manager_name = StringVar(delete_manager_root, value='')
        # 提示性标签
        labelmanager_name = Label(delete_manager_root, text="要删除的管理员ID", font=("微软雅黑 -20"))
        entrymanager_name = Entry(delete_manager_root, textvariable=manager_name)

        labelmanager_name.place(x=200, y=100, height=40, width=200)
        entrymanager_name.place(x=200, y=200, height=40, width=200)

        def Button_Ok():
            db,cur = Sql_link()
            manager_name = eval(entrymanager_name.get())
            #查找对应的ID号
            sql = "SELECT * FROM manager WHERE name = %s"%(manager_name)
            search = cur.execute(sql)
            if(search>0):
                messagebox.showinfo(message="删除成功!")
                #删除目标行
                sql1 = "DELETE FROM manager WHERE name = %s"%(manager_name)
                cur.execute(sql1)
                db.commit()
            else:
                messagebox.showerror(message="该用户不存在!")
        Ok_Button = Button(delete_manager_root, text="确认", font=("微软雅黑 -20"),command=Button_Ok)
        Exit_Button = Button(delete_manager_root, text="退出", font=("微软雅黑 -20"), command=delete_manager_root.destroy)
        Ok_Button.place(x=75, y=350, height=40, width=200)
        Exit_Button.place(x=325, y=350, height=40, width=200)
    #修改密码
    def change_code():
        #创建窗口
        change_code_root = Tk()
        change_code_root.title("管理员信息删除")
        change_code_root.config(width=600)
        change_code_root.config(height=600)

        manager_name = StringVar(change_code_root, value='')
        old_manager_code = StringVar(change_code_root, value='')

        # 提示性标签
        labelmanager_name = Label(change_code_root, text="要修改的管理员ID", font=("微软雅黑 -20"))
        entrymanager_name = Entry(change_code_root, textvariable=manager_name)
        labelold_manager_code = Label(change_code_root, text="请输入原密码", font=("微软雅黑 -20"))
        entryold_manager_code = Entry(change_code_root, textvariable=old_manager_code)

        labelmanager_name.place(x=200, y=50, height=40, width=200)
        entrymanager_name.place(x=200, y=150, height=40, width=200)
        labelold_manager_code.place(x=200, y=250, height=40, width=200)
        entryold_manager_code.place(x=200, y=350, height=40, width=200)

        def Button_Ok():
            db,cur = Sql_link()
            manager_name = eval(entrymanager_name.get())
            #匹配对应的ID
            sql = "SELECT * FROM manager WHERE name = %s"%(manager_name)
            search = cur.execute(sql)
            if(search>0):
                #创建新窗口
                input_code_root = Tk()
                input_code_root.title("管理员密码修改")
                input_code_root.config(width=600)
                input_code_root.config(height=600)
                #设置关联变量
                new_manager_code = StringVar(input_code_root, value='')
                labelnew_manager_code = Label(input_code_root, text="新的密码", font=("微软雅黑 -20"))
                entrynew_manager_code = Entry(input_code_root, textvariable=new_manager_code)
                #设置提示性标签
                labelnew_manager_code.place(x=200, y=200, height=40, width=200)
                entrynew_manager_code.place(x=200, y=300, height=40, width=200)
                def Button_Ok():
                    try:
                        new_manager_code = entrynew_manager_code.get()
                        messagebox.showinfo(message="修改成功!")
                        #利用UPDATE来修改密码
                        sql1 = "UPDATE manager SET code = %s WHERE name = %s" % (new_manager_code,manager_name)
                        cur.execute(sql1)
                        db.commit()
                    except:
                        messagebox.showerror(message="修改失败!")
                Ok_Button = Button(input_code_root, text="确认", font=("微软雅黑 -20"), command=Button_Ok)
                Exit_Button = Button(input_code_root, text="退出", font=("微软雅黑 -20"), command=input_code_root.destroy)
                Ok_Button.place(x=75, y=350, height=40, width=200)
                Exit_Button.place(x=325, y=350, height=40, width=200)

            else:
                messagebox.showerror(message="该用户不存在!")
        Ok_Button = Button(change_code_root, text="确认", font=("微软雅黑 -20"),command=Button_Ok)
        Exit_Button = Button(change_code_root, text="退出", font=("微软雅黑 -20"), command=change_code_root.destroy)
        Ok_Button.place(x=75, y=450, height=40, width=200)
        Exit_Button.place(x=325, y=450, height=40, width=200)
    # 设置按钮
    button_stu1 = Button(change_manager_root, text="删除账号", font=("微软雅黑 -20"),command=delete_manager)
    button_stu2 = Button(change_manager_root, text="修改密码", font=("微软雅黑 -20"),command=change_code)
    button_stu1.place(x=200, y=100, height=40, width=200)
    button_stu2.place(x=200, y=200, height=40, width=200)

    Exit_Button = Button(change_manager_root, text="退出", font=("微软雅黑 -20"), command=change_manager_root.destroy)
    Exit_Button.place(x=200, y=300, height=40, width=200)
#展示学生信息
def show_student():
    #创建窗口
    show_student_root = Tk()
    show_student_root.title("录入学生信息")
    show_student_root.config(width=600)
    show_student_root.config(height=600)
    #输入信息
    def input_grade():
        input_grade_root = Tk()
        input_grade_root.title("学生成绩录入")
        input_grade_root.config(width=600)
        input_grade_root.config(height=900)
        # 定义关联变量
        student_id = StringVar(input_grade_root, value='')
        student_name = StringVar(input_grade_root, value='')
        math_grade = StringVar(input_grade_root, value='')
        python_grade = StringVar(input_grade_root, value='')
        modian_grade = StringVar(input_grade_root, value='')
        shudian_grade = StringVar(input_grade_root, value='')
        # 提示性标签
        labelstudent_id = Label(input_grade_root, text="学生ID", font=("微软雅黑 -20"))
        labelstudent_name = Label(input_grade_root, text="学生姓名", font=("微软雅黑 -20"))
        labelmath_grade = Label(input_grade_root, text="数学成绩", font=("微软雅黑 -20"))
        labelpython_grade = Label(input_grade_root, text="Python成绩", font=("微软雅黑 -20"))
        labelmodian_grade = Label(input_grade_root, text="模电成绩", font=("微软雅黑 -20"))
        labelshudian_grade = Label(input_grade_root, text="数电成绩", font=("微软雅黑 -20"))
        # 设定标签位置
        labelstudent_id.place(x=200, y=50, height=40, width=200)
        labelstudent_name.place(x=200, y=150, height=40, width=200)
        labelmath_grade.place(x=200, y=250, height=40, width=200)
        labelpython_grade.place(x=200, y=350, height=40, width=200)
        labelmodian_grade.place(x=200, y=450, height=40, width=200)
        labelshudian_grade.place(x=200, y=550, height=40, width=200)
        # 定义录入信息文本框,以关联变量形式存储
        entrystudent_id = Entry(input_grade_root, textvariable=student_id)
        entrystudent_id.place(x=200, y=100, height=40, width=200)
        entrystudent_name = Entry(input_grade_root, textvariable=student_name)
        entrystudent_name.place(x=200, y=200, height=40, width=200)
        entrymath_grade = Entry(input_grade_root, textvariable=math_grade)
        entrymath_grade.place(x=200, y=300, height=40, width=200)
        entrypython_grade = Entry(input_grade_root, textvariable=python_grade)
        entrypython_grade.place(x=200, y=400, height=40, width=200)
        entrymodian_grade = Entry(input_grade_root, textvariable=modian_grade)
        entrymodian_grade.place(x=200, y=500, height=40, width=200)
        entryshudian_grade = Entry(input_grade_root, textvariable=shudian_grade)
        entryshudian_grade.place(x=200, y=600, height=40, width=200)
        # 确认以及退出按钮
        def Button_Ok():
            #注意数据类型转换
            db,cur = Sql_link()
            student_id = eval(entrystudent_id.get())
            student_name = entrystudent_name.get()
            math_grade = eval(entrymath_grade.get())
            python_grade = eval(entrypython_grade.get())
            modian_grade = eval(entrymodian_grade.get())
            shudian_grade = eval(entryshudian_grade.get())
            try:
                #这里总分通过求和得到结果
                sql = "INSERT INTO student(ID,NAME,数学成绩,Python成绩,模电成绩,数电成绩,总分)"
                sql += "VALUES(%d,'%s',%.2f,%.2f,%.2f,%.2f,%.2f)"%(
                    student_id,student_name,math_grade,python_grade,modian_grade,
                    shudian_grade,math_grade+python_grade+modian_grade+shudian_grade)
                cur.execute(sql)
                db.commit()
                messagebox.showinfo(message="录入信息成功!")
            except:
                messagebox.showerror(message="录入信息失败!请检查是否有ID重复")
        Ok_Button = Button(input_grade_root, text="确认", font=("微软雅黑 -20"), command=Button_Ok)
        Exit_Button = Button(input_grade_root, text="退出", font=("微软雅黑 -20"), command=input_grade_root.destroy)
        Ok_Button.place(x=75, y=700, height=40, width=200)
        Exit_Button.place(x=325, y=700, height=40, width=200)
    #查询信息
    def search_grade():
        search_grade_root = Tk()
        search_grade_root.title("学生信息查询")
        search_grade_root.config(width=600)
        search_grade_root.config(height=600)
        # 定义关联变量
        student_id = StringVar(search_grade_root, value='')

        # 提示性标签
        labelstudent_id = Label(search_grade_root, text="要查询学生的ID", font=("微软雅黑 -20"))
        # 设定标签位置
        labelstudent_id.place(x=200, y=150, height=40, width=200)
        # 定义录入信息文本框,以关联变量形式存储
        entrystudent_id = Entry(search_grade_root, textvariable=student_id)
        entrystudent_id.place(x=200, y=250, height=40, width=200)
        def Button_Ok():
            show_student_message_root = Tk()
            show_student_message_root.title("学生信息查询")
            show_student_message_root.config(width=600)
            show_student_message_root.config(height=700)
            #创建关联变量
            student_name = StringVar(show_student_message_root, value='')
            math_grade = StringVar(show_student_message_root, value='')
            python_grade = StringVar(show_student_message_root, value='')
            modian_grade = StringVar(show_student_message_root, value='')
            shudian_grade = StringVar(show_student_message_root, value='')
            db,cur = Sql_link()
            student_id = eval(entrystudent_id.get())
            #查找ID对应的学生
            sql = "SELECT * FROM student WHERE ID = %d"%(student_id)
            num = cur.execute(sql)
            if(num>0):
                cursor = cur.fetchall()
                for row in cursor:
                    if(student_id==row[0]):
                        student_name1 = row[1]
                        math_grade1 = row[2]
                        python_grade1 = row[3]
                        modian_grade1 = row[4]
                        shudian_grade1 = row[5]
                student_name.set(student_name1)
                math_grade.set(math_grade1)
                python_grade.set(python_grade1)
                modian_grade.set(modian_grade1)
                shudian_grade.set(shudian_grade1)
                # 提示性标签
                labelstudent_name = Label(show_student_message_root, text="学生姓名", font=("微软雅黑 -20"))
                labelmath_grade = Label(show_student_message_root, text="数学成绩", font=("微软雅黑 -20"))
                labelpython_grade = Label(show_student_message_root, text="Python成绩", font=("微软雅黑 -20"))
                labelmodian_grade = Label(show_student_message_root, text="模电成绩", font=("微软雅黑 -20"))
                labelshudian_grade = Label(show_student_message_root, text="数电成绩", font=("微软雅黑 -20"))
                # 设定标签位置
                labelstudent_name.place(x=200, y=100, height=40, width=200)
                labelmath_grade.place(x=200, y=200, height=40, width=200)
                labelpython_grade.place(x=200, y=300, height=40, width=200)
                labelmodian_grade.place(x=200, y=400, height=40, width=200)
                labelshudian_grade.place(x=200, y=500, height=40, width=200)
                #配置文本框数据
                entrystudent_name = Entry((show_student_message_root), textvariable=student_name)
                entrystudent_name.place(x=200, y=150, height=40, width=200)
                entrymath_grade = Entry((show_student_message_root), textvariable=math_grade)
                entrymath_grade.place(x=200, y=250, height=40, width=200)
                entrypython_grade = Entry((show_student_message_root), textvariable=python_grade)
                entrypython_grade.place(x=200, y=350, height=40, width=200)
                entrymodian_grade = Entry((show_student_message_root), textvariable=modian_grade)
                entrymodian_grade.place(x=200, y=450, height=40, width=200)
                entryshudian_grade = Entry((show_student_message_root), textvariable=shudian_grade)
                entryshudian_grade.place(x=200, y=550, height=40, width=200)

                Exit_Button = Button(show_student_message_root, text="退出", font=("微软雅黑 -20"), command=show_student_message_root.destroy)
                Exit_Button.place(x=200, y=630, height=40, width=200)
            else:
                messagebox.showerror(message="改用户不存在!")

        Ok_Button = Button(search_grade_root, text="确认", font=("微软雅黑 -20"), command=Button_Ok)
        Exit_Button = Button(search_grade_root, text="退出", font=("微软雅黑 -20"), command=search_grade_root.destroy)
        Ok_Button.place(x=75, y=350, height=40, width=200)
        Exit_Button.place(x=325, y=350, height=40, width=200)
    #删除信息
    def delete_data():
        delete_data_root = Tk()
        delete_data_root.title("学生成绩删除")
        delete_data_root.config(width=600)
        delete_data_root.config(height=600)
        # 定义关联变量
        student_id = StringVar(delete_data_root, value='')
        # 提示性标签
        labelstudent_id = Label(delete_data_root, text="学生ID", font=("微软雅黑 -20"))
        # 设定标签位置
        labelstudent_id.place(x=200, y=150, height=40, width=200)
        # 定义录入信息文本框,以关联变量形式存储
        entrystudent_id = Entry(delete_data_root, textvariable=student_id)
        entrystudent_id.place(x=200, y=200, height=40, width=200)
        def Button_Ok():
            db,cur = Sql_link()
            student_id = eval(entrystudent_id.get())
            sql = "DELETE FROM student WHERE ID = %d"%(student_id)
            try:
                cur.execute(sql)
                db.commit()
                messagebox.showinfo(message="删除成功!")
            except:
                messagebox.showerror(message="删除失败!")
        Ok_Button = Button(delete_data_root, text="确认", font=("微软雅黑 -20"), command=Button_Ok)
        Exit_Button = Button(delete_data_root, text="退出", font=("微软雅黑 -20"), command=delete_data_root.destroy)
        Ok_Button.place(x=75, y=300, height=40, width=200)
        Exit_Button.place(x=325, y=300, height=40, width=200)
    #单科排序
    def sort_one_grade():
        sort_one_grade_root = Tk()
        sort_one_grade_root.title("单科成绩排序")
        sort_one_grade_root.config(width=600)
        sort_one_grade_root.config(height=600)
        #回调函数
        def math_sort():
            sort_all_grade_root = Tk()
            sort_all_grade_root.title("数学成绩排序")
            sort_all_grade_root.config(width=600)
            sort_all_grade_root.config(height=600)
            #创建树对象用于展示数据
            sort_one_grade_tree = ttk.Treeview(sort_all_grade_root, height=30,
                                               columns=['1', '2', '3', '4', '5', '6', '7'],
                                               show='tree headings')
            sort_one_grade_tree.column('1', width=100, anchor='center')
            sort_one_grade_tree.column('2', width=100, anchor='center')
            sort_one_grade_tree.column('3', width=100, anchor='center')
            sort_one_grade_tree.column('4', width=100, anchor='center')
            sort_one_grade_tree.column('5', width=100, anchor='center')
            sort_one_grade_tree.column('6', width=100, anchor='center')
            sort_one_grade_tree.column('7', width=100, anchor='center')
            #设置树的表头
            sort_one_grade_tree.heading('1', text='ID')
            sort_one_grade_tree.heading('2', text='NAME')
            sort_one_grade_tree.heading('3', text='数学成绩')
            sort_one_grade_tree.heading('4', text='Python成绩')
            sort_one_grade_tree.heading('5', text='模电成绩')
            sort_one_grade_tree.heading('6', text='数电成绩')
            sort_one_grade_tree.heading('7', text='总分')
            try:
                db, cur = Sql_link()
                #逆向排序
                sql = "SELECT * FROM student ORDER BY 数学成绩 DESC"
                cur.execute(sql)
                db.commit()
                # 给树各项参数赋值,若为NONE值则break
                for i in range(0, 30):
                    results = cur.fetchone()
                    while (results):
                        sort_one_grade_tree.insert('', i, values=results)
                        break
            except:
                messagebox.showerror(message="排序失败!")
            sort_one_grade_tree.pack()

            Exit_Button = Button(sort_all_grade_root, text="退出", font=("微软雅黑 -20"), command=sort_all_grade_root.destroy)
            Exit_Button.place(x=350, y=530, height=40, width=200)
        def Python_sort():
            sort_all_grade_root = Tk()
            sort_all_grade_root.title("Python成绩排序")
            sort_all_grade_root.config(width=600)
            sort_all_grade_root.config(height=600)
            # 创建树对象用于展示数据
            sort_one_grade_tree = ttk.Treeview(sort_all_grade_root, height=30,
                                               columns=['1', '2', '3', '4', '5', '6', '7'],
                                               show='tree headings')
            sort_one_grade_tree.column('1', width=100, anchor='center')
            sort_one_grade_tree.column('2', width=100, anchor='center')
            sort_one_grade_tree.column('3', width=100, anchor='center')
            sort_one_grade_tree.column('4', width=100, anchor='center')
            sort_one_grade_tree.column('5', width=100, anchor='center')
            sort_one_grade_tree.column('6', width=100, anchor='center')
            sort_one_grade_tree.column('7', width=100, anchor='center')
            # 设置树的表头
            sort_one_grade_tree.heading('1', text='ID')
            sort_one_grade_tree.heading('2', text='NAME')
            sort_one_grade_tree.heading('3', text='数学成绩')
            sort_one_grade_tree.heading('4', text='Python成绩')
            sort_one_grade_tree.heading('5', text='模电成绩')
            sort_one_grade_tree.heading('6', text='数电成绩')
            sort_one_grade_tree.heading('7', text='总分')
            try:
                db, cur = Sql_link()
                sql = "SELECT * FROM student ORDER BY Python成绩 DESC"
                cur.execute(sql)
                db.commit()
                # 给树各项参数赋值,若为NONE值则break
                for i in range(0, 30):
                    results = cur.fetchone()
                    while (results):
                        sort_one_grade_tree.insert('', i, values=results)
                        break
            except:
                messagebox.showerror(message="排序失败!")
            sort_one_grade_tree.pack()

            Exit_Button = Button(sort_all_grade_root, text="退出", font=("微软雅黑 -20"), command=sort_all_grade_root.destroy)
            Exit_Button.place(x=350, y=530, height=40, width=200)
        def modian_sort():
            sort_all_grade_root = Tk()
            sort_all_grade_root.title("模电成绩排序")
            sort_all_grade_root.config(width=600)
            sort_all_grade_root.config(height=600)
            # 创建树对象用于展示数据
            sort_one_grade_tree = ttk.Treeview(sort_all_grade_root, height=30,
                                               columns=['1', '2', '3', '4', '5', '6', '7'],
                                               show='tree headings')
            sort_one_grade_tree.column('1', width=100, anchor='center')
            sort_one_grade_tree.column('2', width=100, anchor='center')
            sort_one_grade_tree.column('3', width=100, anchor='center')
            sort_one_grade_tree.column('4', width=100, anchor='center')
            sort_one_grade_tree.column('5', width=100, anchor='center')
            sort_one_grade_tree.column('6', width=100, anchor='center')
            sort_one_grade_tree.column('7', width=100, anchor='center')
            # 设置树的表头
            sort_one_grade_tree.heading('1', text='ID')
            sort_one_grade_tree.heading('2', text='NAME')
            sort_one_grade_tree.heading('3', text='数学成绩')
            sort_one_grade_tree.heading('4', text='Python成绩')
            sort_one_grade_tree.heading('5', text='模电成绩')
            sort_one_grade_tree.heading('6', text='数电成绩')
            sort_one_grade_tree.heading('7', text='总分')
            try:
                db, cur = Sql_link()
                sql = "SELECT * FROM student ORDER BY 模电成绩 DESC"
                cur.execute(sql)
                db.commit()
                # 给树各项参数赋值,若为NONE值则break
                for i in range(0, 30):
                    results = cur.fetchone()
                    while (results):
                        sort_one_grade_tree.insert('', i, values=results)
                        break
            except:
                messagebox.showerror(message="排序失败!")
            sort_one_grade_tree.pack()

            Exit_Button = Button(sort_all_grade_root, text="退出", font=("微软雅黑 -20"), command=sort_all_grade_root.destroy)
            Exit_Button.place(x=350, y=530, height=40, width=200)
        def shudian_sort():
            sort_all_grade_root = Tk()
            sort_all_grade_root.title("数电成绩排序")
            sort_all_grade_root.config(width=600)
            sort_all_grade_root.config(height=600)
            # 创建树对象用于展示数据
            sort_one_grade_tree = ttk.Treeview(sort_all_grade_root, height=30,
                                               columns=['1', '2', '3', '4', '5', '6', '7'],
                                               show='tree headings')
            sort_one_grade_tree.column('1', width=100, anchor='center')
            sort_one_grade_tree.column('2', width=100, anchor='center')
            sort_one_grade_tree.column('3', width=100, anchor='center')
            sort_one_grade_tree.column('4', width=100, anchor='center')
            sort_one_grade_tree.column('5', width=100, anchor='center')
            sort_one_grade_tree.column('6', width=100, anchor='center')
            sort_one_grade_tree.column('7', width=100, anchor='center')
            # 设置树的表头
            sort_one_grade_tree.heading('1', text='ID')
            sort_one_grade_tree.heading('2', text='NAME')
            sort_one_grade_tree.heading('3', text='数学成绩')
            sort_one_grade_tree.heading('4', text='Python成绩')
            sort_one_grade_tree.heading('5', text='模电成绩')
            sort_one_grade_tree.heading('6', text='数电成绩')
            sort_one_grade_tree.heading('7', text='总分')
            try:
                db, cur = Sql_link()
                sql = "SELECT * FROM student ORDER BY 数电成绩 DESC"
                cur.execute(sql)
                db.commit()
                # 给树各项参数赋值,若为NONE值则break
                for i in range(0, 30):
                    results = cur.fetchone()
                    while (results):
                        sort_one_grade_tree.insert('', i, values=results)
                        break
            except:
                messagebox.showerror(message="排序失败!")
            sort_one_grade_tree.pack()

            Exit_Button = Button(sort_all_grade_root, text="退出", font=("微软雅黑 -20"), command=sort_all_grade_root.destroy)
            Exit_Button.place(x=350, y=530, height=40, width=200)
        math_sort_button = Button(sort_one_grade_root,text="数学排序", font=("微软雅黑 -20"), command=math_sort)
        Python_sort_button = Button(sort_one_grade_root, text="Python排序", font=("微软雅黑 -20"), command=Python_sort)
        modian_sort_button = Button(sort_one_grade_root, text="模电排序", font=("微软雅黑 -20"), command=modian_sort)
        shudian_sort_button = Button(sort_one_grade_root, text="数电排序", font=("微软雅黑 -20"), command=shudian_sort)

        math_sort_button.place(x=200, y=100, height=40, width=200)
        Python_sort_button.place(x=200, y=200, height=40, width=200)
        modian_sort_button.place(x=200, y=300, height=40, width=200)
        shudian_sort_button.place(x=200, y=400, height=40, width=200)

        Exit_Button = Button(sort_one_grade_root, text="退出", font=("微软雅黑 -20"), command=sort_one_grade_root.destroy)
        Exit_Button.place(x=200, y=500, height=40, width=200)
    #总分排序
    def sort_all_grade():
        sort_all_grade_root = Tk()
        sort_all_grade_root.title("全科成绩排序")
        sort_all_grade_root.config(width=600)
        sort_all_grade_root.config(height=600)
        # 创建树对象用于展示数据
        sort_one_grade_tree = ttk.Treeview(sort_all_grade_root, height=30, columns=['1', '2', '3', '4', '5', '6', '7'],
                                           show='tree headings')
        sort_one_grade_tree.column('1', width=100, anchor='center')
        sort_one_grade_tree.column('2', width=100, anchor='center')
        sort_one_grade_tree.column('3', width=100, anchor='center')
        sort_one_grade_tree.column('4', width=100, anchor='center')
        sort_one_grade_tree.column('5', width=100, anchor='center')
        sort_one_grade_tree.column('6', width=100, anchor='center')
        sort_one_grade_tree.column('7', width=100, anchor='center')
        # 设置树的表头
        sort_one_grade_tree.heading('1', text='ID')
        sort_one_grade_tree.heading('2', text='NAME')
        sort_one_grade_tree.heading('3', text='数学成绩')
        sort_one_grade_tree.heading('4', text='Python成绩')
        sort_one_grade_tree.heading('5', text='模电成绩')
        sort_one_grade_tree.heading('6', text='数电成绩')
        sort_one_grade_tree.heading('7', text='总分')
        try:
            db,cur = Sql_link()
            sql = "SELECT * FROM student ORDER BY 总分 DESC"
            cur.execute(sql)
            db.commit()
            #给树各项参数赋值,若为NONE值则break
            for i in range(0,30):
                results = cur.fetchone()
                while(results):
                    sort_one_grade_tree.insert('',i,values=results)
                    break
        except:
            messagebox.showerror(message="排序失败!")
        sort_one_grade_tree.pack()

        Exit_Button = Button(sort_all_grade_root, text="退出", font=("微软雅黑 -20"), command=sort_all_grade_root.destroy)
        Exit_Button.place(x=350, y=530, height=40, width=200)
    #设置按钮
    button_stu1 = Button(show_student_root, text="录入成绩信息", font=("微软雅黑 -20"),command=input_grade)
    button_stu2 = Button(show_student_root, text="查询成绩信息", font=("微软雅黑 -20"),command=search_grade)
    button_stu3 = Button(show_student_root, text="删除成绩信息", font=("微软雅黑 -20"),command=delete_data)
    button_stu4 = Button(show_student_root, text="分科成绩排序", font=("微软雅黑 -20"),command=sort_one_grade)
    button_stu5 = Button(show_student_root, text="总科成绩排序", font=("微软雅黑 -20"),command=sort_all_grade)
    button_stu1.place(x=200, y=30, height=40, width=200)
    button_stu2.place(x=200, y=130, height=40, width=200)
    button_stu3.place(x=200, y=230, height=40, width=200)
    button_stu4.place(x=200, y=330, height=40, width=200)
    button_stu5.place(x=200, y=430, height=40, width=200)

    Exit_Button = Button(show_student_root, text="退出", font=("微软雅黑 -20"), command=show_student_root.destroy)
    Exit_Button.place(x=200, y=530, height=40, width=200)

#设置登录界面
root = Tk()
# 禁止最大化按钮(只显示最小化按钮和关闭按钮)
root.resizable(False,False)
root.minsize(600,600) # 最小尺寸
root.maxsize(600,600) # 最大尺寸
root.title("学生信息管理系统")
#设置长宽
root.config(width=600)
root.config(height=600)
# 添加窗口背景图片
canvas = tkinter.Canvas(root,
                        width = 600,  # 指定Canvas组件的宽度
                        height = 600,  # 指定Canvas组件的高度
                        bg = 'white'  # 指定Canvas组件的背景色
                        )
#添加背景图片
image = Image.open('D:\\1.jpg')

im = ImageTk.PhotoImage(image) #用photoImage打开图片
canvas.create_image(200, 170, image=im)  # 使用creat_image将图片添加到Canvas
canvas.pack()#初始化画布完成

main_button1=Button(root,text="管理员用户创建",font=("微软雅黑 -20"),command=create_manager)
main_button2=Button(root,text="管理员密码登录",font=("微软雅黑 -20"),command=load_manager)
main_button3=Button(root,text="管理员信息修改",font=("微软雅黑 -20"),command=change_manager)
main_button1.place(x=200,y=100,height=40,width=200)
main_button2.place(x=200,y=200,height=40,width=200)
main_button3.place(x=200,y=300,height=40,width=200)

Exit_Button = Button(root, text="退出", font=("微软雅黑 -20"), command=root.destroy)
Exit_Button.place(x=200, y=400, height=40, width=200)

root.mainloop()

Python+tkinter 简易学生信息管理系统 Python+tkinter 简易学生信息管理系统 笔者基于tkinter和pymysql开发出一个简易的学生管理系统。 阅读详情

相关推荐

python做学生信息管理系统,python编辑学生信息系统

在我的前一篇博客中我使用了Tinker作为基础,但是Tinker的缺点就是太枯燥,在美化方面不是很容易进行,因此这次我想分享一下使用pyqt5制作的学生管理系统。当然这其实也是我的一个课时作业,在上次的基础上,我们不再使用表格,而是运用大家使用更多的储存数据的方式——mysql数据库,通过调用数据库中的数据来实现我们的增删改查,且带有登录界面的管理系统python简单图案代码。接下来我将与大家分享一下我的学生信息管理系统。

S1112_的博客 2321

python+mysql的学生管理系统

这是一篇基础的基于python的学生管理系统,连接了数据库。我把所有代码都放在这里了,里面也都有详细注释,大家应该都能看懂,希望我的这篇发文能够帮助那些还在学习python的同学,这只是一个很基础的小项目,希望大家能都自己都能跑一下代码感受一下,今天的分享就到此为止了,谢谢大家。

DXK131452000的博客 4754

Python学生成绩管理系统(完整代码)

Python实现一个简单的学生成绩管理系统的完整代码。

AIGC 3万+

基于Python&Tkinter&MySQL实现两层权限的共享图书管理系统

最近要做课设大作业,是一个有两层权限的共享图书管理系统,在之前已经完成了需求分析和概要设计后,现在要开始正式编码了由于有先前学生信息管理系统的工程经验,这次很多细节的东西就带过了 依然是通过Navicat图形化数据库软件来创建数据对象,分别为三种使用者以及书籍,其内部要素如下BOOK CLIENT MANAGER ROOT_MANAGER这些信息可以和思维导图中的对象属性对应上,编码期间我做了一些修改,不过大致是相同的 UI设计我用的是Python自带的GUI库Tkinter 使用者调用程序后最先会进入主菜

Keitheasun的博客 2724

基于Python guI的学生信息管理系统的设计与实现

讲述的是一个使用Python GUI的学习资料管理工具。通过使用Python的Tkinter库和mysql数据库,这个工具可以方便地记录、检索、更新学习资料。本文详细描述了系统的架构设计和实现过程,并对系统进行了功能测试和性能测试。结果表明,该系统具有良好的用户界面和稳定的性能,能够满足学生信息管理的需求。

m0_56073435的博客 3028

Tkinter简易版学生信息管理系统

本文主要利用PyMySQL和Tkinter实现简易版的学生信息管理系统,其功能包括管理员登录、学生登录、学生信息修改,学生信息查看等;系统数据库为MySQL;

qq_56447863的博客 1256

python+mysql+tkinter学生信息管理系统

需求分析 (1)使用mysql存储学生和管理员信息 (2)通过tkinter模块创建图形界面,实现管理员的登录,对学生信息的增删改查,以及修改管理员自己的密码。 整个工程类与方法 数据库设计 使用mysql数据库创建 menege表和student表 menege表的创建: create table manege( user_name varchr(6) not null, user_pwd char(6) not null, user_state int(1) not null primary

weixin_43580438的博客 8977

Python学生信息管理系统源码解析

本文还有配套的精品资源,点击获取 简介:本篇文章深入探讨了一个基于Python的学生信息记录和查询系统,意在帮助读者理解其工作原理并学习Python编程的核心概念和技术。系统包括数据存储、用户交互界面、信息处理等核心模块,使用数据库操作、图形用户界面(GUI)库和Web框架实现。此外,文章还涵盖了模块化设计、错误处理和测试的重要性,以提高代码的可读性和软件项目的可维护性。 ...

weixin_42327217的博客 1762

python学生信息管理系统(Tkinter+GUI+MySQL)

python的tkinter编写的学生信息管理系统,使用MySQL存储数据,实现了登录、注册、增删改查和导出为Excel的功能。

浮生~的博客 2万+

基于tkinter图书管理系统(python大作业)

python可运行,压缩包里有sql库,去年做python大作业使用

学生信息管理系统(python+GUI+mysql).zip

学生信息管理系统(python+GUI+mysql).zip,学生信息管理系统(python+GUI+mysql).zip,学生信息管理系统(python+GUI+mysql).zip 学生信息管理系统(python+GUI+mysql).zip,学生信息管理系统(python+GUI+mysql).zip,学生信息管理系统(python+GUI+mysql).zip 学生信息管理系统(python+GUI+mysql).zip,学生信息管理系统(python+GUI+mysql).zip,学生信息管理系统(python+GUI+mysql).zip 学生信息管理系统(python+GUI+mysql).zip,学生信息管理系统(python+GUI+mysql).zip,学生信息管理系统(python+GUI+mysql).zip 学生信息管理系统(python+GUI+mysql).zip,学生信息管理系统(python+GUI+mysql).zip,学生信息管理系统(python+GUI+mysql).zip 学生信息管理系统(python+GUI+mysql).zip

Python学生管理系统+MySQL+tkinter+pyinstaller

Entry(root, textvariable=sid1).place(relx=0.1, rely=0.05, relwidth=0.37, height=25)Entry(root, textvariable=name1).place(relx=0.6, rely=0.05, relwidth=0.37, height=25)Entry(root, textvariable=sex1).place(relx=0.1, rely=0.1, relwidth=0.37, height=25)Entry(r

2401_83641098的博客 769

Unity机械拆装实战:5步搞定发动机模型交互式装配(附完整代码)

本文详细介绍了在Unity中实现高交互性机械拆装仿真的完整流程。以发动机模型为例,通过5个核心步骤:项目初始化与模型准备、核心交互实现、智能装配逻辑、场景管理与相机控制、进阶优化与扩展,系统讲解了从零构建交互式装配功能的方法,并提供了完整的代码示例。

weixin_28049429的博客 215

基于python+tkinter+mysql的学生信息管理系统(高分课程设计)

0、用户登陆、用户注册1、 增加学生信息:输入姓名、学号、年龄、性别、手机号、宿舍号2、 修改学生信息:输入姓名、学号、年龄、性别、手机号、宿舍号3、 删除学生信息:以学号为索引4、 查询学生信息:以学号为索引5、 显示学生信息:一条一条整页显示。运行环境:PyCharm/python3.9/mysql5.7以上。

python0328的博客 2253

别再硬编码了!Flowable工作流动态审批人配置全解析(Spring Boot集成版)

本文深入解析Flowable工作流在Spring Boot中的动态审批人配置技术,通过角色、部门等变量实现审批流程的灵活设计。文章详细介绍了架构原理、前端配置映射、动态候选组解析及查询优化方案,帮助企业提升审批流程的适应性和维护效率。

weixin_30919571的博客 134

Unity UGUI高斯模糊背景效果 简易解决方案

UnityUI背景模糊效果简易解决方案1.功能描述简易界面框架搭建合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入 1.功能描述 在我们玩游戏的时候,经常会看到一些游戏会对UI做这样的处理: 可以看到,新开的上层UI界面会以下层UI界面的模糊

SaberZG的博客 1万+

Python+MySQL+Tkinter 学生信息管理系统速成:用 TaoToken 统一 Key 打通数据库与界面联调

Python+MySQL+Tkinter 学生信息管理系统联调常卡在 Key 分散、报错难定位。本文用 TaoToken 统一管理模型调用凭证,配合独立 config 管理数据库参数,带你走完建库建表、CRUD、界面回显三步验证,并排查 401、local proxy failed 等常见错误。官网:https://taotoken.net/?utm_source=taotoken_aicg_blog_end

DiamondWolf89的博客 160

【运动规划算法项目实战】全覆盖分区算法

全覆盖规划在机器人学领域具有重要意义,其应用场景涵盖了自动农场、扫地机器人、扫描监视无人机等多个领域。该问题的核心目标是使机器人能够从指定起点出发,规划一条避开障碍物、同时路径尽可能短的轨迹,从而实现对特定区域的全面覆盖。在实际应用中,全覆盖规划的成功实现对于提高机器人在各类环境中的工作效率至关重要。这一问题的解决涉及到高效的路径规划和规划区域分解技术。其中,梯形单元分解算法是一种常用分区的技术,过将地图上需要规划的区域进行分区,采用梯形分解的方式,可以更好地应对复杂环境。全覆盖算法规划流程。

xiewf的博客 1万+

Python: 学生信息管理系统(tkinter界面带登陆系统)

使用MySQL存储登录信息和学生信息,增删改查,简单ui设计。

weixin_51029543的博客 1942

RT-DETR训练前的准备,将数据集划分成训练集、测试集验证集(附完整脚本及使用说明)

在计算机视觉领域,当我们着手训练一个模型时,。其中,将数据集划分为和更是一项基础性且关键的操作。这篇博客分析了这一划分背后的原因、其重要意义以及如何通过代码实现,帮助大家更好地理解和运用这一技巧,。

Limiiiing的博客 906

一次搞定 SAP IDoc 失败重处理与安全清理:BD87 实战指南

本文介绍了SAP IDoc错误处理的BD87实战指南。主要内容包括: BD87的核心功能:监控IDoc处理状态并支持人工重处理或标记删除,适用于入站/出站IDoc故障处理。 重处理前的关键步骤: 区分技术错误与业务错误 检查是否允许重复处理 确认日期范围设置正确 标准操作流程:通过BD87选择错误IDoc节点执行重处理,特别适用于状态51的应用错误。 标记删除操作:将无用IDoc标记为可清理状态,后续可通过WE11物理删除或归档处理。 常见问题解决方案:包括权限控制、批量处理优化建议以及自动化定位工具的开发

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 452

python学生信息管理系统(Tkinter+GUI)

python的Tkinter编写的学生信息管理系统,实现了增删改查和保存为Excel的功能,使用Excel保存数据,不使用MySQL。

浮生~的博客 3879

C#的GDI+绘图详解

/消除锯齿 或 AntiAlias。// 1.在窗体或控件的Paint事件中,用PaintEventArgs e 创建绘图对象 ---- 控件或窗体重绘时。//为控件创建绘图对象。//--------------------以上方法三选一。//2.创建绘图对象 panel1中绘图。

weixin_50920631的博客 3457

Python题目:学生信息管理系统-高级版(图形界面+MySQL数据库)

Python题目:学生信息管理系统-高级版(图形界面+MySQL数据库) 使用图形界面显示,选用list、tuple、dictionary或map等数据结构,操作数据库存储X个学生的三门课的成绩(机器学习、Python程序设计、研究生英语),并实现以下功能: 1.添加学生信息 2.修改学生信息 3.删除学生 4.添加学生的成绩 5.修改学生成绩 6.按姓名或者学号查找学生,显示学...

清晨的光明 8万+

YOLOv11改进 - 卷积Conv | PATConv(Partial Attention Convolution)部分注意力卷积,在减少计算量的同时融合卷积与注意力的优势 | AAAI 2026

本文提出部分注意力卷积(PATConv)机制,并将其集成到YOLOv11中。传统神经网络中,卷积计算密集,注意力机制全局计算冗余,此前的“部分卷积”会丢失未计算通道的特征价值。PATConv通过“通道拆分 - 并行处理 - 结果拼接”的逻辑,给不同通道分配“擅长的任务”,兼顾局部与全局特征。基于此,它还衍生出PAT_ch、PAT_sp和PAT_sf三种细分模块。此外,还提出了动态部分卷积(DPConv),并构建了新的混合网络家族PartialNet。我们将PATConv代码集成到YOLOv11中,实验表明,

魔改工程师的博客 1085

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

上一篇: HAL库配置STM32F1系列定时器驱动步进电机(四)(梯形加减速)
下一篇: 从MT6816开始了解磁编码器
K-ei-th
博客等级 码龄6年 369粉丝 36原创
评论 9
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值