Zulko / pianoputer

Use your computer keyboard as a "piano".
http://zulko.github.io/blog/2014/03/29/soundstretching-and-pitch-shifting-in-python/
Other
324 stars 92 forks source link

Fixes a small pygame bug #27

Closed spiderman-idog closed 1 year ago

spiderman-idog commented 2 years ago

Issue:

(Using pygame 2.1.2) Pianoputer closes itself when starting, and leaves this error:

line 287, in play_until_user_exits
    elif event.key == pygame.K_ESCAPE:
AttributeError: 'Event' object has no attribute 'key'

Not sure if this bug happens in old pygame versions

Solution

It's needed to first check if the event type is pygame.KEYDOWN first, then check if the event key is pygame.K_ESCAPE