Here is the code and what is shown in the console:
image
I was trying to follow this tutorial:
https://pythonhosted.org/pyglet/programming_guide/key
VulcanWMin 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:
def on_key_press(symbol, modifiers):
pass
def on_key_release(symbol, modifiers):
pass
`2 years ago
image
Why do I receive this error when this code is run? The print command is accurate. I am trying to run two threads at the same time so I can exit
MocaCDeveloperPython is very strict with it's indentation.
On line 15, you have declared a while loop, which thusly requires you to indent line 16, 16, 18 and 19.2 years ago
VulcanWMDo ctrl + a (or cmd + a depending on which type of laptop you are on, if you are on one)
and then do tab and then shift + tab2 years ago
VulcanWMsome packages are already installed like getkey
so in the Python code you just need to do import getkey
other packages which are not that popular, so you can either do the pip installing in the shell or do os.system(“pip install package_name”) in the Python code to install the package and import package_name to import it and use it kn your code2 years ago