Skip to content
Sign upLog in
Profile icon

Carter Timmons

@CarterTimmons03
Repls
Community
CarterTimmons03
CarterTimmons03
shared a Post
1 year ago
How do I use the on_key_press function?
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
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 `1 year ago
CarterTimmons03
CarterTimmons03
shared a Post
1 year ago
How do I use the OnKey function? I am new to python and cannot figure it out. Thanks :D
VulcanWM
VulcanWM
This might help: https://pythonhosted.org/pyglet/programmingguide/keyboardevents.html1 year ago
CarterTimmons03
CarterTimmons03
I just want todetect when space is presssed1 year ago
CarterTimmons03
CarterTimmons03
shared a Post
1 year 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
Animated Console Test
Python
Geocube101
Geocube101
Try using the getkey module1 year ago
CarterTimmons03
CarterTimmons03
shared a Post
1 year 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
MocaCDeveloper
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.1 year ago
VulcanWM
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 + tab1 year ago
CarterTimmons03
CarterTimmons03
shared a Post
1 year 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
SixBeeps
That's because you're calling break. break will always escape the loop. Instead, I think you're looking for continue.1 year ago
CarterTimmons03
CarterTimmons03
shared a Post
1 year ago
This is probably really simple, but how do I install something, such as pip install getkey
StudioHawaii
StudioHawaii
thanks9 months ago
VulcanWM
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 code1 year ago
CarterTimmons03
CarterTimmons03
shared a Post
1 year 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
MrVoo
MrVoo
Use the getkey module1 year ago