作品说明
import tkinter as tk
# 创建主窗口
window = tk.Tk()
# 设置窗口名称和窗口大小
window.geometry("300x200")
window.title("奇偶性判断")
# 输入框:输入数字
entry_number = tk.Entry(window)
entry_number.place(x=50, y=25) # 设置输入框的位置
# 输入框:显示结果(奇数或偶数)
entry_result = tk.Entry(window)
entry_result.place(x=50, y=75) # 设置结果输入框的位置
def check_number():
pass
# 按钮:点击后判断数字的奇偶性
btn_check = tk.Button(window, text="判断", command=check_number)
btn_check.place(x=50, y=125) # 设置按钮的位置
# 启动窗口
window.mainloop()