Skip to content

Examples broken call to View.close on ESC #2538

Closed
@cdeil

Description

@cdeil

There's a few examples that call View.close on ESC key.

Here:

# Close the window / exit game
elif key == arcade.key.ESCAPE:
self.close()

Here:

# Quit if the player hits escape
elif symbol == arcade.key.ESCAPE:
self.close()

Here, but it's dead code since ESC is tested twice in elif statements and only the first is executed:

elif key == arcade.key.ESCAPE:
self.player.start_pressed = True
# close the window if the user hits the escape key
elif key == arcade.key.ESCAPE:
self.close()

Here:

if key == arcade.key.ESCAPE:
self.close()

I presume this is a recent API change, but I don't see it mentioned here!?

https://github.com/pythonarcade/arcade/blob/development/CHANGELOG.md#window-and-view

What is the proper fix / coding pattern here to process ESC when sub-classing arcade.View?

I can send a PR if you let me know.

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