Skip to content
Python Turtle onkeypress() and onkeyrelease()
Profile icon

I don't know much about Python or coding in general, so this could just be some ignorance on my part. Disclaimer out of the way, I cant seem to use the functions above. I just get an error saying it has no attribute 'onkeypress()'. Is it not supported or something? Is this normal? Am I just a complete moron and forgot to put some crucial line for setup? Please let me know, Thanks.

You are viewing a single comment. View All
Profile icon

Try this:
screen=turtle.Screen() create screen turtle
def up(): create function for onkey
while True:
screen.onkey(up,"Up") screen.onkey(function,key)