Carter Timmons
@CarterTimmons03
Here is the code and what is shown in the console:
image
I was trying to follow this tutorial:
https://pythonhosted.org/pyglet/programmingguide/keyb
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:
def onkeypress(symbol, modifiers):
pass
def onkeyrelease(symbol, modifiers):
pass
`2 years ago
How do I use the OnKey function? I am new to python and cannot figure it out.
Thanks :D
VulcanWM This might help: https://pythonhosted.org/pyglet/programmingguide/keyboardevents.html2 years ago
I have an animation playing in the console. I want the loop to stop when space is pressed. This could be done by breaking or with a while loop. I do n
Python
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
MocaCDeveloper Python 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
VulcanWM Do 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
I am trying to break out of a loop once the SPACE key is pressed. I was using GetKey but it doesn't let the loop continue until it is executed.
from
SixBeeps That's because you're calling break. break will always escape the loop. Instead, I think you're looking for continue.2 years ago
This is probably really simple, but how do I install something, such as
pip install getkey
VulcanWM some 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 packagename”) in the Python code to install the package and import packagename to import it and use it kn your code2 years ago
I am trying to detect when a key is pressed (space), but i cannot figure out how. I have researched it, but every answer does not work and gives me an