from 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)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)