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
    • 260
    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.

     

    rom tkinter import *
          from tkinter import ttk
          import datetime
          from tkcalendar import DateEntry,Calendar
    
          # fuction to get the event date(is there a way to get the other info)
    
        def grad_date(self, event):
            self.eventl.config(text="Selected Date is: " + 
            self.buyingcarsrigcal.get_date())
    
    
         self.events = self.cursorObj.execute('SELECT 
          registration_check_date, car_type FROM buying_rigistration_date 
          order by registration_check_date')
         
        self.buying_registrationdates_event_output=self.cursorObj.fetchall()
        self.eventdict=dict(self.buying_registrationdates_event_output)
    
    
        self.buyingcarsrigcal = Calendar(self.buyingcars_calendar_frame, 
        selectmode='day',year=2022, month=1,day=1)
        self.buyingcarsrigcal.pack(pady=20, fill="both", expand=True)
    
        for k in self.eventdict.keys():
            date = datetime.strptime(k, "%m-%d-%Y").date()
            self.buyingcarsrigcal.calevent_create(date, self.eventdict[k] 
            [0], self.eventdict[k][1])
    
    
        self.eventl = Label(self.buyingcars_calendar_frame, text="")
        self.eventl.pack(pady=20)
    
        self.buyingcarsrigcal.bind("<<CalendarSelected>>",self.grad_date)

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: