用python tkinter完成学生信息管理系统
时间: 2023-08-28 07:04:28 浏览: 123
使用Python的Tkinter库可以实现学生信息管理系统的界面设计。你可以参考以下代码来完成这个任务:
```python
from tkinter import *
from tkinter.messagebox import *
import sqlite3
from tkinter import ttk
# 创建主窗口
window = Tk()
window.title("学生信息管理系统")
# 创建标签和输入框
label_name = Label(window, text="姓名:")
label_name.grid(row=0, column=0)
entry_name = Entry(window)
entry_name.grid(row=0, column=1)
label_id = Label(window, text="学号:")
label_id.grid(row=1, column=0)
entry_id = Entry(window)
entry_id.grid(row=1, column=1)
label_age = Label(window, text="年龄:")
label_age.grid(row=2, column=0)
entry_age = Entry(window)
entry_age.grid(row=2, column=1)
label_phone = Label(window, text="手机号:")
label_phone.grid(row=3, column=0)
entry_phone = Entry(window)
entry_phone.grid(row=3, column=1)
# 创建按钮
def add_student():
name = entry_name.get()
id = entry_id.get()
age = entry_age.get()
phone = entry_phone.get()
# 将学生信息保存到数据库或进行其他操作
messagebox.showinfo("提示", "添加学生信息成功")
def modify_student():
name = entry_name.get()
id = entry_id.get()
age = entry_age.get()
phone = entry_phone.get()
# 根据学生学号修改学生信息
messagebox.showinfo("提示", "修改学生信息成功")
button_add = Button(window, text="添加学生信息", command=add_student)
button_add.grid(row=4, column=0)
button_modify = Button(window, text="修改学生信息", command=modify_student)
button_modify.grid(row=4, column=1)
# 运行主窗口
window.mainloop()
```
这段代码使用了Tkinter库来创建一个包含姓名、学号、年龄和手机号的学生信息管理系统界面。通过点击"添加学生信息"按钮和"修改学生信息"按钮,可以将输入的学生信息保存到数据库或进行其他操作。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [python+tkinter实现学生管理系统](https://download.csdn.net/download/weixin_38630463/13999221)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *2* [python Tkinter版学生管理系统](https://download.csdn.net/download/weixin_38733281/13992137)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
- *3* [python实现的学生信息管理系统—GUI界面版](https://download.csdn.net/download/qq_40957277/85174195)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 33.333333333333336%"]
[ .reference_list ]
阅读全文