宿舍管理系统是一个用于管理学生宿舍的系统,它可以包括学生信息管理、宿舍分配、费用管理等功能。以下是一个使用Python编写的宿舍管理系统运行演示:
```python
import tkinter as tk
from tkinter import messagebox
class DormitoryManagementSystem:
def __init__(self, root):
self.root = root
self.root.title("宿舍管理系统")
self.root.geometry("800x600")
# 创建主窗口
self.main_window = tk.Tk()
self.main_window.configure(bg="lightblue")
self.main_window.resizable(False, False)
self.main_window.bind("
# 创建学生信息输入框
self.student_info_input = tk.Entry(self.main_window, width=40)
self.student_info_input.grid(row=0, column=0, padx=10, pady=10)
# 创建宿舍分配输入框
self.dormitory_assignment_input = tk.Entry(self.main_window, width=40)
self.dormitory_assignment_input.grid(row=1, column=0, padx=10, pady=10)
# 创建费用输入框
self.fee_input = tk.Entry(self.main_window, width=40)
self.fee_input.grid(row=2, column=0, padx=10, pady=10)
# 创建按钮
self.submit_button = tk.Button(self.main_window, text="提交", command=self.submit)
self.submit_button.grid(row=3, column=0, padx=10, pady=10)
def submit(self):
student_id = self.student_info_input.get()
dormitory_id = int(self.dormitory_assignment_input.get())
fee = float(self.fee_input.get())
# 模拟数据存储
self.store_data(student_id, dormitory_id, fee)
# 显示结果
result = "宿舍分配成功!"
messagebox.showinfo("结果", result)
def store_data(self, student_id, dormitory_id, fee):
# 这里可以添加实际的数据存储逻辑,例如将数据存储到数据库或文件中
print(f"学生ID:{student_id},宿舍ID:{dormitory_id},费用:{fee}")
if __name__ == "__main__":
root = tk.Tk()
DormitoryManagementSystem(root)
root.mainloop()
```
这个程序使用了Python的Tkinter库来创建一个简单的图形用户界面(GUI)。用户可以在主窗口中输入学生信息、宿舍分配和费用,然后点击“提交”按钮将数据存储到内存中。最后,程序会显示一个消息框告知用户宿舍分配成功。