May 2019
Intermediate to advanced
542 pages
13h 37m
English
The save_event() callback will be called whenever the Add/Update button is pushed. It starts like this:
def save_event(self): event = { 'category': self.event_category.currentText(), 'time': ( None if self.allday_check.isChecked() else self.event_time.time() ), 'title': self.event_title.text(), 'detail': self.event_detail.toPlainText() }
In this code, we are now calling the accessor methods to retrieve the values from the widgets and assign them to the appropriate keys of the event's dictionary.
Next, we'll retrieve the current event list for the selected date and determine whether this is an addition or an update:
date = self.calendar.selectedDate() event_list = self.events.get(date, []) event_number = self.event_list.currentRow() ...
Read now
Unlock full access