Tkinter एप्लिकेशन बनाने और विकसित करने के लिए एक लोकप्रिय पायथन लाइब्रेरी है। इसमें विभिन्न तरीके और कार्य हैं जिनका उपयोग किसी एप्लिकेशन में कई सुविधाओं को जोड़ने के लिए किया जा सकता है।
टकैलेंडर टिंकर पैकेज में से एक है जिसका उपयोग विंडो में जीयूआई-आधारित कैलेंडर बनाने के लिए किया जा सकता है और इस प्रकार, हम डेटा का चयन करने, कैलेंडर एप्लिकेशन के माध्यम से ईवेंट को चुनने और शेड्यूल करने जैसे कई ऑपरेशन कर सकते हैं।
हालाँकि, इस लेख में, हम देखेंगे कि कैसे हम Tkcalendar पैकेज का उपयोग करके डेट पिकर कैलेंडर बना सकते हैं। इससे पहले, हमें pip install tkcalendar का उपयोग करके अपने स्थानीय वातावरण में पैकेज को स्थापित करना होगा। ।
एक बार इंस्टॉल हो जाने पर, हम tkcalendar का एक उदाहरण बनाएंगे और तारीख पाने के लिए एक बटन बनाएंगे।
उदाहरण
#Import the libraries
from tkinter import *
from tkcalendar import *
#Create an instance of tkinter frame or window
win= Tk()
win.title("Calendar")
win.geometry("700x600")
cal= Calendar(win, selectmode="day",year= 2021, month=3, day=3)
cal.pack(pady=20)
#Define Function to select the date
def get_date():
label.config(text=cal.get_date())
#Create a button to pick the date from the calendar
button= Button(win, text= "Select the Date", command= get_date)
button.pack(pady=20)
#Create Label for displaying selected Date
label= Label(win, text="")
label.pack(pady=20)
win.mainloop() आउटपुट
उपरोक्त कोड को चलाने से एक कैलेंडर बन जाएगा, जहां हम एक विशेष तिथि का चयन कर सकते हैं।
