Skip to content

Instantly share code, notes, and snippets.

@stephengruppetta
Created November 17, 2023 22:49
Show Gist options
  • Save stephengruppetta/010fe687752991527bd6792bcb4b5f2c to your computer and use it in GitHub Desktop.
Save stephengruppetta/010fe687752991527bd6792bcb4b5f2c to your computer and use it in GitHub Desktop.
# magic_sparkle.py
import turtle
BACKGROUND_COLOUR = "#1a6b72"
lead_dot_speed = 1
lead_dot_rotation_angle = 5
window = turtle.Screen()
window.bgcolor(BACKGROUND_COLOUR)
lead_dot = turtle.Turtle()
lead_dot.shape("circle")
lead_dot.color("white")
lead_dot.penup()
def turn_left():
lead_dot.left(lead_dot_rotation_angle)
def turn_right():
lead_dot.right(lead_dot_rotation_angle)
window.onkeypress(turn_left, "Left")
window.onkeypress(turn_right, "Right")
window.listen()
while True:
lead_dot.forward(lead_dot_speed)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment