首页 > 其他分享 >暑假第一周总结

暑假第一周总结

时间:2023-06-25 23:26:13浏览次数:33  
标签:总结 第一周 column window grid tk 暑假 entry row

本周我在学校进行小学期内容——数据结构

数据结构我选择的个人项目为:教师信息管理系统,本次训练使用的语言为python

由添加教师信息,删除教师信息,修改教师信息,查找教师信息等模块组成

源码如下:、

import tkinter as tk
from tkinter import ttk
from tkinter import messagebox
import datetime
from tkinter import *

# 添加教师信息
def add_teacher():
    add_window = tk.Toplevel()
    add_window.title("添加教师信息")
    # 创建标签和文本框
    id_label = tk.Label(add_window, text="教师号:")
    id_label.grid(row=0, column=0)

    id_entry = tk.Entry(add_window)
    id_entry.grid(row=0, column=1)

    name_label = tk.Label(add_window, text="姓名:")
    name_label.grid(row=1, column=0)

    name_entry = tk.Entry(add_window)
    name_entry.grid(row=1, column=1)

    id_number_label = tk.Label(add_window, text="身份证号:")
    id_number_label.grid(row=2, column=0)

    id_number_entry = tk.Entry(add_window)
    id_number_entry.grid(row=2, column=1)

    address_label = tk.Label(add_window, text="地址:")
    address_label.grid(row=3, column=0)

    address_entry = tk.Entry(add_window)
    address_entry.grid(row=3, column=1)

    phone_label = tk.Label(add_window, text="电话号码:")
    phone_label.grid(row=4, column=0)

    phone_entry = tk.Entry(add_window)
    phone_entry.grid(row=4, column=1)

    department_label = tk.Label(add_window, text="部门:")
    department_label.grid(row=5, column=0)

    department_entry = tk.Entry(add_window)
    department_entry.grid(row=5, column=1)

    salary_label = tk.Label(add_window, text="工资:")
    salary_label.grid(row=6, column=0)

    salary_entry = tk.Entry(add_window)
    salary_entry.grid(row=6, column=1)

    start_date_label = tk.Label(add_window, text="工作开始日期:")
    start_date_label.grid(row=7, column=0)

    start_date_entry = tk.Entry(add_window)
    start_date_entry.grid(row=7,column=1)
    major_label = tk.Label(add_window, text="专业:")
    major_label.grid(row=8, column=0)

    major_entry = tk.Entry(add_window)
    major_entry.grid(row=8, column=1)

    position_label = tk.Label(add_window, text="职位:")
    position_label.grid(row=9, column=0)

    position_entry = tk.Entry(add_window)
    position_entry.grid(row=9, column=1)

    remark_label = tk.Label(add_window, text="备注:")
    remark_label.grid(row=10, column=0)

    remark_entry = tk.Entry(add_window)
    remark_entry.grid(row=10, column=1)

    # 创建“确定”按钮
    confirm_button = tk.Button(
        add_window,
        text="确定",
        command=lambda: save_teacher(
            id_entry.get(),
            name_entry.get(),
            id_number_entry.get(),
            address_entry.get(),
            phone_entry.get(),
            department_entry.get(),
            salary_entry.get(),
            start_date_entry.get(),
            major_entry.get(),
            position_entry.get(),
            remark_entry.get(),
            add_window,
            )
        )
    confirm_button.grid(row=11, column=0, pady=10)
    cancel_button = tk.Button(
    add_window,
    text="取消",
    command=add_window.destroy
    )
    cancel_button.grid(row=11, column=1, pady=10)
def save_teacher(id, name, id_number, address, phone, department, salary, start_date, major, position, remark, window):
          with open('teachers.txt', 'a') as f:
            f.write(f'{id},{name},{id_number},{address},{phone},{department},{salary},{start_date},{major},{position},{remark}\n')
            messagebox.showinfo("提示", "添加成功!")
            window.destroy()
# 删除教师信息
def delete_teacher():
    # 创建删除教师信息的窗口
    delete_window = tk.Toplevel()
    delete_window.title("删除教师信息")

    # 创建标签和文本框
    id_label = tk.Label(delete_window, text="教师编号:")
    id_label.grid(row=0, column=0)

    id_entry = tk.Entry(delete_window)
    id_entry.grid(row=0, column=1)

    # 创建“确定”按钮
    confirm_button = tk.Button(
        delete_window,
        text="确定",
        command=lambda: confirm_delete(id_entry.get(), delete_window)
    )
    confirm_button.grid(row=1, column=0, pady=10)

    # 创建“取消”按钮
    cancel_button = tk.Button(
        delete_window,
        text="取消",
        command=delete_window.destroy
    )
    cancel_button.grid(row=1, column=1, pady=10)

# 确认删除教师信息
def confirm_delete(teacher_id, window):
    with open('teachers.txt', 'r') as f:
        lines = f.readlines()

    with open('teachers.txt', 'w') as f:
        for line in lines:
            if not line.startswith(teacher_id):
                f.write(line)

    messagebox.showinfo("提示", "删除成功!")

    # 关闭窗口
    window.destroy()

# 修改教师信息
def modify_teacher():
    # 创建修改教师信息的窗口
    modify_window = tk.Toplevel()
    modify_window.title("修改教师信息")

    # 创建标签和文本框
    id_label = tk.Label(modify_window, text="教师编号:")
    id_label.grid(row=0, column=0)

    id_entry = tk.Entry(modify_window)
    id_entry.grid(row=0, column=1)

    name_label = tk.Label(modify_window, text="姓名:")
    name_label.grid(row=1, column=0)

    name_entry = tk.Entry(modify_window)
    name_entry.grid(row=1, column=1)

    id_number_label = tk.Label(modify_window, text="身份证号:")
    id_number_label.grid(row=2, column=0)

    id_number_entry = tk.Entry(modify_window)
    id_number_entry.grid(row=2, column=1)

    address_label = tk.Label(modify_window, text="地址:")
    address_label.grid(row=3, column=0)

    address_entry = tk.Entry(modify_window)
    address_entry.grid(row=3, column=1)

    phone_label = tk.Label(modify_window, text="手机号:")
    phone_label.grid(row=4, column=0)

    phone_entry = tk.Entry(modify_window)
    phone_entry.grid(row=4, column=1)

    department_label = tk.Label(modify_window, text="部门:")
    department_label.grid(row=5, column=0)

    department_entry = tk.Entry(modify_window)
    department_entry.grid(row=5, column=1)

    salary_label = tk.Label(modify_window, text="工资:")
    salary_label.grid(row=6, column=0)

    salary_entry = tk.Entry(modify_window)
    salary_entry.grid(row=6, column=1)

    start_date_label = tk.Label(modify_window, text="参加工作的时间:")
    start_date_label.grid(row=7, column=0)

    start_date_entry = tk.Entry(modify_window)
    start_date_entry.grid(row=7, column=1)

    major_label = tk.Label(modify_window, text="专业:")
    major_label.grid(row=8, column=0)

    major_entry = tk.Entry(modify_window)
    major_entry.grid(row=8, column=1)

    position_label = tk.Label(modify_window, text="职务:")
    position_label.grid(row=9, column=0)

    position_entry = tk.Entry(modify_window)
    position_entry.grid(row=9, column=1)

    remark_label = tk.Label(modify_window, text="备注:")
    remark_label.grid(row=10, column=0)

    remark_entry = tk.Entry(modify_window)
    remark_entry.grid(row=10, column=1)

    # 创建“确定”按钮
    confirm_button = tk.Button(
        modify_window,
        text="确定",
        command=lambda: confirm_modify(
            id_entry.get(),
            name_entry.get(),
            id_number_entry.get(),
            address_entry.get(),
            phone_entry.get(),
            department_entry.get(),
            salary_entry.get(),
            start_date_entry.get(),
            major_entry.get(),
            position_entry.get(),
            remark_entry.get(),
            modify_window
        )
    )
    confirm_button.grid(row=11, column=0, pady=10)

    # 创建“取消”按钮
    cancel_button = tk.Button(
        modify_window,
        text="取消",
        command=modify_window.destroy
    )
    cancel_button.grid(row=11, column=1, pady=10)

# 确认修改教师信息
def confirm_modify(teacher_id, name, id_number, address,phone, department, salary, start_date, major, position, remark, window):
    with open('teachers.txt', 'r') as f:
        lines = f.readlines()

    with open('teachers.txt', 'w') as f:
        for line in lines:
            if line.startswith(teacher_id):
                new_line = f"{teacher_id},{name},{id_number},{address},{phone},{department},{salary},{start_date},{major},{position},{remark}\n"
                f.write(new_line)
            else:
                f.write(line)
    messagebox.showinfo("提示", "修改成功!")


    # 关闭窗口
    window.destroy()

def search1(window):
    search1_window = tk.Toplevel(window)
    search1_window.title("教师编号查询")

    # 创建标签和文本框
    id_label = tk.Label(search1_window, text="教师编号:")
    id_label.grid(row=0, column=0)

    id_entry = tk.Entry(search1_window)
    id_entry.grid(row=0, column=1)

    # 创建“确定”按钮
    confirm_button = tk.Button(
        search1_window,
        text="确定",
        command=lambda: confirm_search1(id_entry.get(), text)
    )
    confirm_button.grid(row=1, column=0, pady=10)
    cancel_button = tk.Button(
        search1_window,
        text="取消",
        command=search1_window.destroy
    )
    cancel_button.grid(row=1, column=1, pady=10)
     # 创建结果区域,并添加滚动条
    text = tk.Text(search1_window)
    text.grid(row=2, columnspan=2)
    scrollbar = tk.Scrollbar(search1_window, command=text.yview)
    scrollbar.grid(row=2, column=2, sticky='NS')
    text.config(yscrollcommand=scrollbar.set)

def confirm_search1(teacher_id, text):
     with open('teachers.txt', 'r') as f:
      lines = f.readlines()
      # 清空文本框内容
      text.delete('1.0', tk.END)

     for line in lines:
        teacher_info = line.split(',')
     if (not teacher_id or teacher_info[0] == teacher_id):
        text.insert(tk.END, line)


# 教师姓名查询
def search2(window):
    # 创建教师姓名查询的窗口
    search2_window = tk.Toplevel(window)
    search2_window.title("教师姓名查询")

    # 创建标签和文本框
    name_label = tk.Label(search2_window, text="教师姓名:")
    name_label.grid(row=0, column=0)

    name_entry = tk.Entry(search2_window)
    name_entry.grid(row=0, column=1)

    # 创建“确定”按钮
    confirm_button = tk.Button(
        search2_window,
        text="确定",
        command=lambda: confirm_search2(name_entry.get(), text)
    )
    confirm_button.grid(row=1, column=0, pady=10)

    # 创建“取消”按钮
    cancel_button = tk.Button(
        search2_window,
        text="取消",
        command=search2_window.destroy
    )
    cancel_button.grid(row=1, column=1, pady=10)

    # 创建结果区域,并添加滚动条
    text = tk.Text(search2_window)
    text.grid(row=2, columnspan=2)
    scrollbar = tk.Scrollbar(search2_window, command=text.yview)
    scrollbar.grid(row=2, column=2, sticky='NS')
    text.config(yscrollcommand=scrollbar.set)

# 确认教师姓名查询
def confirm_search2(name, text):
    with open('teachers.txt', 'r') as f:
        lines = f.readlines()

    # 清空文本框内容
    text.delete('1.0', tk.END)

    for line in lines:
        teacher_info = line.split(',')
        if (not name or teacher_info[1] == name):
            text.insert(tk.END, line)

    text.insert(tk.END, line)

# 教师工作日期长短查询
import datetime

def search3(window):
    # 创建教师工作日期长短查询的窗口
    search3_window = tk.Toplevel(window)
    search3_window.title("教师工作日期长短查询")

    # 创建标签和文本框
    start_date_label = tk.Label(search3_window, text="起始日期(格式:YYYY-MM-DD):")
    start_date_label.grid(row=0, column=0)

    start_date_entry = tk.Entry(search3_window)
    start_date_entry.grid(row=0, column=1)

    end_date_label = tk.Label(search3_window, text="截止日期(格式:YYYY-MM-DD):")
    end_date_label.grid(row=1, column=0)

    end_date_entry = tk.Entry(search3_window)
    end_date_entry.grid(row=1, column=1)

    # 创建“确定”按钮
    confirm_button = tk.Button(
        search3_window,
        text="确定",
        command=lambda: confirm_search3(
            start_date_entry.get(),
            end_date_entry.get(),
            text
        )
    )
    confirm_button.grid(row=2, column=0, pady=10)

    # 创建“取消”按钮
    cancel_button = tk.Button(
        search3_window,
        text="取消",
        command=search3_window.destroy
    )
    cancel_button.grid(row=2, column=1, pady=10)

    # 创建结果区域,并添加滚动条
    text = tk.Text(search3_window)
    text.grid(row=3, columnspan=2)
    scrollbar = tk.Scrollbar(search3_window, command=text.yview)
    scrollbar.grid(row=3, column=2, sticky='NS')
    text.config(yscrollcommand=scrollbar.set)

# 确认教师工作日期长短查询
def confirm_search3(start_date, end_date, text):
    with open('teachers.txt', 'r') as f:
        lines = f.readlines()

    # 清空文本框内容
    text.delete('1.0', tk.END)

    # 转换起始和截止日期为datetime对象
    start_date = datetime.datetime.strptime(start_date, '%Y-%m-%d') if start_date else None
    end_date = datetime.datetime.strptime(end_date, '%Y-%m-%d') if end_date else None

    for line in lines:
        teacher_info = line.split(',')

        # 获取教师工作日期
        start_date_str = teacher_info[7]

        # 转换教师工作日期为datetime对象
        if start_date_str:
            start_date1 = datetime.datetime.strptime(start_date_str, '%Y-%m-%d')
        else:
            start_date1 = None

        if not start_date and not end_date:
            text.insert(tk.END, line)
        elif not start_date and start_date1 <= end_date:
            text.insert(tk.END, line)
        elif not end_date and start_date1 >= start_date:
            text.insert(tk.END, line)
        elif start_date1 >= start_date and start_date1 <= end_date:
            text.insert(tk.END, line)

    text.insert(tk.END, line)
def search4(window):
    search4_window = tk.Toplevel(window)
    search4_window.title("教师工资范围查询")
    # 创建标签和文本框
    min_salary_label = tk.Label(search4_window, text="最低工资:")
    min_salary_label.grid(row=0, column=0)

    min_salary_entry = tk.Entry(search4_window)
    min_salary_entry.grid(row=0, column=1)

    max_salary_label = tk.Label(search4_window, text="最高工资:")
    max_salary_label.grid(row=1, column=0)

    max_salary_entry = tk.Entry(search4_window)
    max_salary_entry.grid(row=1, column=1)

    # 创建“确定”按钮
    confirm_button = tk.Button(
        search4_window,
        text="确定",
        command=lambda: confirm_search4(
            min_salary_entry.get(),
            max_salary_entry.get(),
            text,
            search4_window
        )
    )
    confirm_button.grid(row=2, column=0, pady=10)

    # 创建“取消”按钮
    cancel_button = tk.Button(
        search4_window,
        text="取消",
        command=search4_window.destroy
    )
    cancel_button.grid(row=2, column=1, pady=10)

    # 创建结果区域,并添加滚动条
    text = tk.Text(search4_window)
    text.grid(row=3, columnspan=2)
    scrollbar = tk.Scrollbar(search4_window, command=text.yview)
    scrollbar.grid(row=3, column=2, sticky='NS')
    text.config(yscrollcommand=scrollbar.set)

# 确认教师工资范围查询
def confirm_search4(min_salary, max_salary, text, window):
    with open('teachers.txt', 'r') as f:
        lines = f.readlines()

    # 清空文本框内容
    text.delete('1.0', tk.END)

    for line in lines:
        teacher_info = line.strip().split(',')
        if len(teacher_info) <= 6: # 行数据不完整
            continue
        salary = int(teacher_info[6])
        if not min_salary and not max_salary:
            text.insert(tk.END, line)
        elif not min_salary and salary <= int(max_salary):
            text.insert(tk.END, line)
        elif not max_salary and salary >= int(min_salary):
            text.insert(tk.END, line)
        elif salary >= int(min_salary) and salary <= int(max_salary):
            text.insert(tk.END, line)

def search5(window):
    search5_window = tk.Toplevel(window)
    search5_window.title("教师出生年月范围查询")
    # 创建标签和文本框
    min_birth_label = tk.Label(search5_window, text="最早出生年月:")
    min_birth_label.grid(row=0, column=0)

    min_birth_entry = tk.Entry(search5_window)
    min_birth_entry.grid(row=0, column=1)

    max_birth_label = tk.Label(search5_window, text="最晚出生年月:")
    max_birth_label.grid(row=1, column=0)

    max_birth_entry = tk.Entry(search5_window)
    max_birth_entry.grid(row=1, column=1)

    # 创建“确定”按钮
    confirm_button = tk.Button(
        search5_window,
        text="确定",
        command=lambda: confirm_search5(
            min_birth_entry.get(),
            max_birth_entry.get(),
            result_text,
            search5_window
        )
    )
    confirm_button.grid(row=2, column=0, pady=10)

    # 创建“取消”按钮
    cancel_button = tk.Button(
        search5_window,
        text="取消",
        command=search5_window.destroy
    )
    cancel_button.grid(row=2, column=1, pady=10)

    # 创建结果显示框
    result_text = tk.Text(search5_window, height=10, width=50)
    result_text.grid(row=3, column=0, columnspan=2)

    def confirm_search5(min_birth, max_birth, result_text, window):
        try:
            min_date = datetime.datetime.strptime(min_birth, "%Y-%m-%d")
            max_date = datetime.datetime.strptime(max_birth, "%Y-%m-%d")
            with open('teachers.txt', 'r') as f:
                lines = f.readlines()
                for line in lines:
                    teacher_info = line.split(',')
                    ID = teacher_info[2]
                    birthy = None
                    if len(ID) == 18:
                        year = int(ID[6:10])
                        month = int(ID[10:12])
                        date = int(ID[12:14])
                        birthy = datetime.datetime(year, month, date)
                    if not min_date and not max_date:
                        result_text.insert(tk.END, line)
                    elif not min_date and birthy <= max_date:
                        result_text.insert(tk.END, line)
                    elif not max_date and birthy >= min_date:
                        result_text.insert(tk.END, line)
                    elif birthy >= min_date and birthy <= max_date:
                        result_text.insert(tk.END, line)

                result_text.insert(tk.END, "教师信息查找完成!")
                messagebox.showinfo("提示", "搜索完成!")
        except ValueError:
            messagebox.showerror("错误", "请输入正确的日期格式!")


def search6(window):
    search6_window = tk.Toplevel(window)
    search6_window.title("多条件查询教师信息")
    # 创建标签和文本框
    teacher_id_label = tk.Label(search6_window, text="教师号:")
    teacher_id_label.grid(row=0, column=0)

    teacher_id_entry = tk.Entry(search6_window)
    teacher_id_entry.grid(row=0, column=1)

    name_label = tk.Label(search6_window, text="姓名:")
    name_label.grid(row=1, column=0)

    name_entry = tk.Entry(search6_window)
    name_entry.grid(row=1, column=1)

    start_date_label = tk.Label(search6_window, text="工作开始日期:")
    start_date_label.grid(row=2, column=0)

    start_date_entry = tk.Entry(search6_window)
    start_date_entry.grid(row=2, column=1)

    end_date_label = tk.Label(search6_window, text="工作结束日期:")
    end_date_label.grid(row=3, column=0)

    end_date_entry = tk.Entry(search6_window)
    end_date_entry.grid(row=3, column=1)

    min_salary_label = tk.Label(search6_window, text="最低工资:")
    min_salary_label.grid(row=4, column=0)

    min_salary_entry = tk.Entry(search6_window)
    min_salary_entry.grid(row=4, column=1)

    max_salary_label = tk.Label(search6_window, text="最高工资:")
    max_salary_label.grid(row=5, column=0)

    max_salary_entry = tk.Entry(search6_window)
    max_salary_entry.grid(row=5, column=1)

    min_birth_label = tk.Label(search6_window, text="最早出生年月:")
    min_birth_label.grid(row=6, column=0)

    min_birth_entry = tk.Entry(search6_window)
    min_birth_entry.grid(row=6, column=1)

    max_birth_label = tk.Label(search6_window, text="最晚出生年月:")
    max_birth_label.grid(row=7, column=0)

    max_birth_entry = tk.Entry(search6_window)
    max_birth_entry.grid(row=7, column=1)

    # 创建“确定”按钮
    confirm_button = tk.Button(
        search6_window,
        text="确定",
        command=lambda: confirm_search6(
            teacher_id_entry.get(),
            name_entry.get(),
            start_date_entry.get(),
            end_date_entry.get(),
            min_salary_entry.get(),
            max_salary_entry.get(),
            min_birth_entry.get(),
            max_birth_entry.get(),
            result_text,
            search6_window
        )
    )
    confirm_button.grid(row=8, column=0, pady=10)

    # 创建“取消”按钮
    cancel_button = tk.Button(
        search6_window,
        text="取消",
        command=search6_window.destroy
    )
    cancel_button.grid(row=8, column=1, pady=10)

    # 创建结果显示框
    result_text = tk.Text(search6_window, height=10, width=50)
    result_text.grid(row=9, column=0, columnspan=2)

    def confirm_search6(teacher_id, name, start_date, end_date, min_salary, max_salary, min_birth, max_birth, result_text, window):
            with open('teachers.txt', 'r') as f:
                lines = f.readlines()
                # 工作时间长短
                start_date = datetime.datetime.strptime(start_date, '%Y-%m-%d') if start_date else None
                end_date = datetime.datetime.strptime(end_date, '%Y-%m-%d') if end_date else None
                # 年龄大小
                min_date = datetime.datetime.strptime(min_birth, "%Y-%m-%d")
                max_date = datetime.datetime.strptime(max_birth, "%Y-%m-%d")

                for line in lines:
                    teacher_info = line.split(',')
                    # 获取教师工作日期
                    start_date_str = teacher_info[7]
                    # 获取讲师身份证号
                    ID = teacher_info[2]
                    birthy = None
                    if len(ID) == 18:
                        year = int(ID[6:10])
                        month = int(ID[10:12])
                        date = int(ID[12:14])
                        birthy = datetime.datetime(year, month, date)
                    # 转换教师工作日期为datetime对象
                    if start_date_str:
                        start_date1 = datetime.datetime.strptime(start_date_str, '%Y-%m-%d')
                    else:
                        start_date1 = None

                    if (

                            (not teacher_id or teacher_info[0] == teacher_id) and
                            (not name or teacher_info[1] == name) and
                            (not start_date and not end_date or
                             (not start_date and start_date1<= end_date) or
                             (not end_date and start_date1 >= start_date) or
                             (start_date1>= start_date and start_date1 <= end_date)
                            ) and
                            (not min_salary and not max_salary or
                             (not min_salary and teacher_info[6] <= max_salary) or
                             (not max_salary and teacher_info[6] >= min_salary) or
                             (teacher_info[6] >= min_salary and teacher_info[6] <= max_salary)
                            ) and
                            (not min_date and not max_date or
                             (not min_date and birthy <= max_date) or
                             (not max_date and birthy>= min_date) or
                             (birthy >= min_date and birthy <= max_date)
                            )
                        ):
                        result_text.insert(tk.END, line)

                result_text.insert(tk.END, "教师信息查找完成!")
                messagebox.showinfo("提示", "搜索完成!")

def search_teacher():
    window = tk.Tk()
    window.title("教师信息查找")
    # 创建“教师编号查询”按钮
    search1_button = tk.Button(
        text="教师编号查询",
        command=lambda: search1(window)
    )
    search1_button.pack(padx=10, pady=5)

    # 创建“教师姓名查询”按钮
    search2_button = tk.Button(
        text="教师姓名查询",
        command=lambda: search2(window)
    )
    search2_button.pack(padx=10, pady=5)

    # 创建“教师工作日期长短查询”按钮
    search3_button = tk.Button(
        text="教师工作日期长短查询",
        command=lambda: search3(window)
    )
    search3_button.pack(padx=10, pady=5)

    # 创建“教师工资范围查询”按钮
    search4_button = tk.Button(
        text="教师工资范围查询",
        command=lambda: search4(window)
    )
    search4_button.pack(padx=10, pady=5)

    # 创建“教师出生年月范围查询”按钮
    search5_button= tk.Button(text="教师出生年月范围查询",command=lambda: search5(window))
    search5_button.pack(padx=10, pady=5)
    # 创建“多条件查询”按钮
    search6_button = tk.Button(
        text="多条件查询",
        command=lambda: search6(window)
    )
    search6_button.pack(padx=10, pady=5)
    window.mainloop()

def create_window():
    window = tk.Tk()
    window.title("教师管理系统")

    # 添加教师按钮
    add_btn = tk.Button(window, text="添加教师信息", command=add_teacher)
    add_btn.pack(pady=10)

    # 删除教师按钮
    delete_btn = tk.Button(window, text="删除教师信息", command=delete_teacher)
    delete_btn.pack(pady=10)

    # 修改教师按钮
    modify_btn = tk.Button(window, text="修改教师信息", command=modify_teacher)
    modify_btn.pack(pady=10)

    # 查找教师按钮
    search_btn = tk.Button(window, text="查找教师信息", command=search_teacher)
    search_btn.pack(pady=10)

    # 退出按钮
    exit_btn = tk.Button(window, text="退出", command=window.quit)
    exit_btn.pack(pady=10)

    window.mainloop()

if __name__ == '__main__':
    create_window()

 

运行结果如下图所示:

 

 

 

标签:总结,第一周,column,window,grid,tk,暑假,entry,row
From: https://www.cnblogs.com/jiacheng-712/p/17504226.html

相关文章

  • 假期第一周进度报告
       本周代码时间20多个小时,主要用于完成小学期的数据结构作业的第一阶段与第二阶段。6月19日:试实现迪杰斯特拉最短路径算法。后可使用迪杰斯特拉算法进行最短路径的实现,对于每一点的初始化了解较深,但是对于v0到每一个顶点的最短路径的循环迭代,已经更新确实难以弄清。最后从......
  • 本周总结
    总结--数据结构结束啦!(剩下明天验收)本周做了什么?数据结构小学期正式结束,ppt改版,计划书修改;遇到的困难?时间有一点儿不够用;解决方法?熬夜增加时间;下周预计?数据库小学期来啦!继续做ppt!......
  • 第一周
    importtkinterastkfromtkinterimportfiledialogclassMyTextEditor:def__init__(self,master):self.master=masterself.master.title("我的文本编辑器")self.master.geometry('900x700')self.creat_menu()......
  • 15. AOP总结
    1.AOP的核心概念概念:AOP(AspectOrientedProgramming)面向切面编程,一种编程范式作用:在不惊动原始设计的基础上为方法进行功能增强核心概念代理(Proxy):SpringAOP的核心本质是采用代理模式实现的连接点(JoinPoint):在SpringAOP中,理解为任意方法的执行切入点(Pointcut):匹配连......
  • 大二暑假第一周总结
    这一周是数据结构的小学期,学了最小生成树的Prim算法,矩阵运算,链式基数排序等算法。第二阶段设计了渡船管理模拟系统,是用Python语言写的。Python语言强大且方便,有很多库和函数的功能都是意想不到的好用。课程设计工作日报表时间:2023年  6月16日序号工作分类工作......
  • 每周总结
    6.19前一天到家,早上简单收拾了一下行李,然后去报名了驾校准备考驾照,报名后就去体检了,体检非常顺利,前后就预约了科一,开始看题库做模拟题,感觉这题出了好多新规题变难了,感觉要是不好好看题就给挂了,回家后看了看科一的题。吃个午饭睡了一下午,醒了后打了会游戏刷了会儿视频就又吃饭了,吃......
  • 电脑版 - imessages群发,苹果imessages短信,苹果imessages推信,完美实现总结
    一、PC电脑版苹果系统(MacOS)上实现imessages群发总结为以下几种方式:/*MacOS苹果系统,正常情况下,只能安装到苹果公司自己出品的Mac电脑,俗称白苹果,不能安装到各种组装机或者其他品牌的品牌机上,黑苹果的的原理,就是通过一些“破解补丁”工具欺骗macOS系统,让苹果系统认为你的......
  • Python 知识点总结-- join 拼接
    路径拼接   path.join() 和str.join() 区别path.join() join方法是一个不定长参数path.join()是python中的OS模块中的方法,使用前需要导入os 用于将多个路径拼接成一个完整的路径。使用该方法时,需要将需要的拼接的路径以参数的形式传递给该方法importosfull......
  • 第三阶段PTA题目集总结及课程的教学评价
    目录前言:PTA题目集:7-1统计Java程序中关键词的出现次数设计与分析:具体代码踩坑心得改进建议课程成绩统计程序-1设计与分析:具体代码踩坑心得改进建议课程成绩统计程序-2设计与分析:具体代码踩坑心得改进建议课程成绩统计程序-3设计与分析:具体代码踩坑心得改进建议总结:课程的教学评价......
  • 基于多算法融合的啸叫抑制方案总结
    前记 在对讲和本地扩音领域,啸叫抑制是一个无法绕过去的话题。怎么抑制啸叫是一个非常棘手的问题。笔者及团队在这个方向研究了好久。终于取得了一些阶段性的进展。这里做一下梳理。 心路历程 刚开始想依靠单纯的算法去解决。做了很多仿真,发现都不是很理想。不是抑制太狠了......