python学生成绩管理系统giu
时间: 2023-12-25 21:30:10 浏览: 92
抱歉,根据提供的引用内容,我无法找到关于Python学生成绩管理系统GUI的具体信息。但是,我可以为您提供一个基本的Python学生成绩管理系统的示例代码,您可以根据自己的需求进行修改和扩展。
```python
import tkinter as tk
class Student:
def __init__(self, name, score):
self.name = name
self.score = score
class GradeManagementSystem:
def __init__(self):
self.students = []
def add_student(self, name, score):
student = Student(name, score)
self.students.append(student)
def get_average_score(self):
total_score = 0
for student in self.students:
total_score += student.score
average_score = total_score / len(self.students)
return average_score
def get_highest_score(self):
highest_score = 0
for student in self.students:
if student.score > highest_score:
highest_score = student.score
return highest_score
# 创建GUI界面
class GUI:
def __init__(self):
self.system = GradeManagementSystem()
self.window = tk.Tk()
self.window.title("学生成绩管理系统")
self.name_label = tk.Label(self.window, text="姓名:")
self.name_label.pack()
self.name_entry = tk.Entry(self.window)
self.name_entry.pack()
self.score_label = tk.Label(self.window, text="成绩:")
self.score_label.pack()
self.score_entry = tk.Entry(self.window)
self.score_entry.pack()
self.add_button = tk.Button(self.window, text="添加学生", command=self.add_student)
self.add_button.pack()
self.average_score_button = tk.Button(self.window, text="平均成绩", command=self.get_average_score)
self.average_score_button.pack()
self.highest_score_button = tk.Button(self.window, text="最高成绩", command=self.get_highest_score)
self.highest_score_button.pack()
self.result_label = tk.Label(self.window, text="")
self.result_label.pack()
self.window.mainloop()
def add_student(self):
name = self.name_entry.get()
score = int(self.score_entry.get())
self.system.add_student(name, score)
self.name_entry.delete(0, tk.END)
self.score_entry.delete(0, tk.END)
def get_average_score(self):
average_score = self.system.get_average_score()
self.result_label.config(text="平均成绩:{}".format(average_score))
def get_highest_score(self):
highest_score = self.system.get_highest_score()
self.result_label.config(text="最高成绩:{}".format(highest_score))
gui = GUI()
```
这是一个简单的学生成绩管理系统的GUI界面,您可以通过输入学生的姓名和成绩来添加学生,然后可以点击按钮获取平均成绩和最高成绩。您可以根据需要进行修改和扩展。
阅读全文