Tkcalendar package tạo calendar GUI. Cài: pip install tkcalendar.
Tạo Calendar widget, nút chọn ngày, label hiển thị ngày đã chọn.
Ví dụ
from tkinter import *
from tkcalendar import *
win = Tk()
win.title("Calendar")
win.geometry("700x600")
cal = Calendar(win, selectmode="day", year=2021, month=3, day=3)
cal.pack(pady=20)
def get_date():
label.config(text=cal.get_date())
Button(win, text="Select the Date", command=get_date).pack(pady=20)
Label(win, text="").pack(pady=20)
win.mainloop()Kết quả
Calendar chọn ngày, click nút hiển thị ngày đã chọn.
