Skip to content

Chapter 3 calendar code quits unexpectedly #16

@eramey16

Description

@eramey16

Hello,
While running the calendar code from Chapter 3 (Handling Events with Signals and Slots), I ran into an error while testing out the app. If I create a new event, select the event, then click on a new calendar day, the program exits with this error:

Traceback (most recent call last):
  File "test_app_2.py", line 167, in populate_form
    event_data = self.events.get(date)[event_number]
TypeError: 'NoneType' object is not subscriptable
Abort trap: 6

I downloaded the code from github to make sure the error wasn't just in my program, and the behavior was the same. I fixed this issue in my own code by adding self.event_list.setCurrentRow(-1) to the first line of the populate_list function, which clears the event list selection when a new day is selected on the calendar.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions