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
# SPDX-FileCopyrightText: 2021 ladyada for Adafruit Industries # SPDX-License-Identifier: MIT import board from adafruit_turtle import Color, turtle turtle = turtle(board.DISPLAY) benzsize = min(board.DISPLAY.width, board.DISPLAY.height) * 0.5 print("Turtle time! Lets draw a rainbow benzene") colors = (Color.RED, Color.ORANGE, Color.YELLOW, Color.GREEN, Color.BLUE, Color.PURPLE) turtle.pendown() start = turtle.pos() for x in range(benzsize): turtle.pencolor(colors[x % 6]) turtle.forward(x) turtle.left(59) while True: pass
import board from adafruit_turtle import Color, turtle turtle = turtle(board.DISPLAY) print("Turtle time! Lets draw a simple square") turtle.pencolor(Color.WHITE) print("Position:", turtle.pos()) print("Heading:", turtle.heading()) turtle.penup() print("Pen down?", turtle.isdown()) turtle.pendown() print("Pen down?", turtle.isdown()) turtle.forward(25) print("Position:", turtle.pos()) turtle.left(90) turtle.forward(25) print("Position:", turtle.pos()) turtle.left(90) turtle.forward(25) print("Position:", turtle.pos()) turtle.left(90) turtle.forward(25) print("Position:", turtle.pos()) while True: pass