79462136

Date: 2025-02-23 23:13:18
Score: 0.5
Natty:
Report link

It is possible to use the onkeypress() function, however, the name of the shift key is "Shift_L", which is the shift key on the left, and "Shift_R", which is the shift key on the right. This is what the code should look like:

import turtle
walk_speed=10
def sprint():
    global walk_speed
    walk_speed+=8
def slow():
    global walk_speed
    walk_speed-=8
screen.onkeypress(sprint, "Shift_L")
screen.onkeyrelease(slow, "Shift_L")
screen.onkeypress(sprint, "Shift_R")
screen.onkeyrelease(slow, "Shift_R")
Reasons:
  • Long answer (-0.5):
  • Has code block (-0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user29769305