Imagine a robotic turtle starting at (0, 0) in the x-y plane. After an import turtle, give it the command turtle.forward(15), and it moves (on-screen!) 15 pixels in the direction it is facing, drawing a line as it moves. Give it the command turtle.right(25), and it rotates in-place 25 degrees clockwise.
# Turtle Star # Adapted from https://docs.python.org/3/library/turtle.html # Turtle can draw intricate shapes using programs that repeat simple moves. from turtle import * size=790 color('green', 'blue') speed('fastest') setpos(-size/2,-32) start=pos() # Note starting position begin_fill() while True: forward(size) left (170) if abs(pos()-start) < 1: # have we come back to start? break end_fill() done()
Turtle graphics is a term in computer graphics vector graphics using a relative cursor (the "turtle") upon a Cartesian plane. Turtle graphics is a key feature of the Logo programming language.