Ask coding questions

← Back to all posts
How do I use the on_key_press function?
CarterTimmons03

Here is the code and what is shown in the console:

I was trying to follow this tutorial:
https://pythonhosted.org/pyglet/programming_guide/keyboard_events.html

Voters
CarterTimmons03
Comments
hotnewtop
VulcanWM

in a function, you can only enter a variable when defining the function (no . in the variable name)
why don't you try the code at the starting of the website: