Computer >> कंप्यूटर ट्यूटोरियल >  >> प्रोग्रामिंग >> Python

Tkinter में Date Picker Calendar बनाएं

Tkinter एप्लिकेशन बनाने और develop करने के लिए एक लोकप्रिय Python library है। इसमें विभिन्न methods और functions हैं जिनका उपयोग एप्लिकेशन में multiple features add करने के लिए किया जा सकता है।

Tkcalendar tkinter packages में से एक है जिसका उपयोग window में GUI-based calendars बनाने के लिए किया जा सकता है और इस प्रकार, हम calendar application के माध्यम से data select करने, pick और schedule करने जैसे multiple operations perform कर सकते हैं।

हालांकि, इस लेख में, हम देखेंगे कि Tkcalendar package का उपयोग करके Date Picker calendar कैसे बनाया जाए। उससे पहले, हमें package को अपने local environment में pip install tkcalendar का उपयोग करके install करना होगा।

एक बार install हो जाने पर, हम tkcalendar का instance बनाएंगे और date प्राप्त करने के लिए एक button बनाएंगे।

उदाहरण

# 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()

आउटपुट

उपरोक्त code चलाने से एक calendar बनेगा, जहां हम एक particular date select कर सकते हैं।

Tkinter में Date Picker Calendar बनाएं

  1. Tkinter का उपयोग करके Splash Screen कैसे बनाएं? Tkinter का उपयोग करके Splash Screen कैसे बनाएं?

    मान लीजिए हम tkinter का उपयोग करके splash screen बनाना चाहते हैं। Splash screen बनाने के लिए, हम नीचे दिए गए steps का पालन करेंगे: कुछ labels के साथ splash screen बनाएं। overrideredirect method का उपयोग करके splash screen को borderless बनाएं। मुख्य window के लिए एक function बनाएं जो splash screen क

  1. Python में Tkinter का उपयोग करके डिजिटल घड़ी बनाना Python में Tkinter का उपयोग करके डिजिटल घड़ी बनाना

    Python Tkinter का उपयोग वेब और डेस्कटॉप के लिए सभी प्रकार के GUI प्रोग्राम बनाने के लिए किया जा सकता है। इस लेख में हम देखेंगे कि घंटे, मिनट और सेकंड लाइव प्रदर्शित करने वाली डिजिटल घड़ी कैसे बनाई जाए। हम समय को घंटे, मिनट और सेकंड प्रारूप में प्रदर्शित करने वाली विधि strftime को आयात करने के लिए ti

  1. Python - Tkinter में geometry मेथड Python - Tkinter में geometry मेथड

    Python में Tkinter लाइब्रेरी का उपयोग करके GUI एप्लिकेशन बनाने की क्षमता है। लाइब्रेरी GUI एप्लिकेशन के लिए उपयोगी कई मेथड्स प्रदान करती है। geometry मेथड एक मौलिक है जो स्क्रीन लेआउट के आकार, स्थिति और कुछ अन्य विशेषताओं को तय करता है जिसे हम बनाने जा रहे हैं। उदाहरण - 1 नीचे दिए गए प्रोग्राम में