1 Star 0 Fork 1

jack2583/PythonExamples

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
Calendar (GUI) 877 Bytes
一键复制 编辑 原始数据 按行查看 历史
madhur-garg 提交于 2020-10-07 10:39 +08:00 . Create Calendar (GUI)
from tkinter import *
import calendar
root = Tk()
# root.geometry("400x300")
root.title("Calendar")
# Function
def text():
month_int = int(month.get())
year_int = int(year.get())
cal = calendar.month(year_int, month_int)
textfield.delete(0.0, END)
textfield.insert(INSERT, cal)
# Creating Labels
label1 = Label(root, text="Month:")
label1.grid(row=0, column=0)
label2 = Label(root, text="Year:")
label2.grid(row=0, column=1)
# Creating spinbox
month = Spinbox(root, from_=1, to=12, width=8)
month.grid(row=1, column=0, padx=5)
year = Spinbox(root, from_=2000, to=2100, width=10)
year.grid(row=1, column=1, padx=10)
# Creating Button
button = Button(root, text="Go", command=text)
button.grid(row=1, column=2, padx=10)
# Creating Textfield
textfield = Text(root, width=25, height=10, fg="red")
textfield.grid(row=2, columnspan=2)
root.mainloop()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/jack2583/pythonExamples.git
git@gitee.com:jack2583/pythonExamples.git
jack2583
pythonExamples
PythonExamples
master

搜索帮助