Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • is there a way to insert specific event dates and other info in a calendar date cell

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 315
    Answer it

    I am trying to select data from the sqllite3 database and insert them into the tkcalendar so the user can insert his event info (registration_check_date, car_type) and view them by clicking on the calendar specific colored date cell, I had converted the selected database data into a tuple, so it's can be inserted as a colored event cell in the calendar but the only info I get is the date when I clicked in the event cell, is there a way to get the date and car_type in a label.

     

    1. rom tkinter import *
    2. from tkinter import ttk
    3. import datetime
    4. from tkcalendar import DateEntry,Calendar
    5.  
    6. # fuction to get the event date(is there a way to get the other info)
    7.  
    8. def grad_date(self, event):
    9. self.eventl.config(text="Selected Date is: " +
    10. self.buyingcarsrigcal.get_date())
    11.  
    12.  
    13. self.events = self.cursorObj.execute('SELECT
    14. registration_check_date, car_type FROM buying_rigistration_date
    15. order by registration_check_date')
    16. self.buying_registrationdates_event_output=self.cursorObj.fetchall()
    17. self.eventdict=dict(self.buying_registrationdates_event_output)
    18.  
    19.  
    20. self.buyingcarsrigcal = Calendar(self.buyingcars_calendar_frame,
    21. selectmode='day',year=2022, month=1,day=1)
    22. self.buyingcarsrigcal.pack(pady=20, fill="both", expand=True)
    23.  
    24. for k in self.eventdict.keys():
    25. date = datetime.strptime(k, "%m-%d-%Y").date()
    26. self.buyingcarsrigcal.calevent_create(date, self.eventdict[k]
    27. [0], self.eventdict[k][1])
    28.  
    29.  
    30. self.eventl = Label(self.buyingcars_calendar_frame, text="")
    31. self.eventl.pack(pady=20)
    32.  
    33. self.buyingcarsrigcal.bind("<<CalendarSelected>>",self.grad_date)

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Reset Password
Fill out the form below and reset your password: