Adafruit_CircuitPython_turtle/examples/turtle_star.py
2020-03-06 07:52:46 -05:00

24 lines
482 B
Python

import board
from adafruit_turtle import Color, turtle
turtle = turtle(board.DISPLAY)
starsize = min(board.DISPLAY.width, board.DISPLAY.height) * 0.9 # 90% of screensize
print("Turtle time! Lets draw a star")
turtle.pencolor(Color.BLUE)
turtle.setheading(90)
turtle.penup()
turtle.goto(-starsize/2, 0)
turtle.pendown()
start = turtle.pos()
while True:
turtle.forward(starsize)
turtle.left(170)
if abs(turtle.pos() - start) < 1:
break
while True:
pass