May 2019
Intermediate to advanced
542 pages
13h 37m
English
The first actual callback method is populate_list(), which looks like this:
def populate_list(self): self.event_list.clear() self.clear_form() date = self.calendar.selectedDate() for event in self.events.get(date, []): time = ( event['time'].toString('hh:mm') if event['time'] else 'All Day' ) self.event_list.addItem(f"{time}: {event['title']}")
This will be called whenever the calendar selection is changed, and its job is to repopulate the event_list widget with the events from that day. It starts by clearing the list and the form. It then retrieves the selected date from the calendar widget using its selectedDate() method.
Then, we cycle through the list of events for the selected date's self.events dictionary, ...
Read now
Unlock full access