🎨
TomsRiver.xyz
  • Welcome!
  • Day 1
    • Activity
  • Day 2
    • Activity
  • Day 3
    • Activity
  • Day 4
    • Activity
  • Day 5
    • Activity
  • Day 6
    • Activity
  • Day 7
    • Activity
  • Day 8
    • Activity
Powered by GitBook
On this page
  • Presentation
  • Python Turtle Interactive Mode
  • Python Turtle Script Mode
  • Turtle Commands

Was this helpful?

  1. Day 1

Activity

PreviousWelcome!NextActivity

Last updated 3 years ago

Was this helpful?

Presentation

Python Turtle Interactive Mode

Python Turtle Script Mode

Turtle Commands

Command

Description

turtle.forward(distance)

Move the turtle forward by the specified distance, in the direction the turtle is headed.

turtle.backward(distance)

Move the turtle backward by distance, opposite to the direction the turtle is headed.

turtle.home()

Move turtle to the origin – coordinates (0,0) – and set its heading to its start-orientation.

turtle.penup()

Pull the pen up – no drawing when moving.

turtle.pendown()

Pull the pen down – drawing when moving.

turtle.pencolor(colorstring)

Set pencolor to colorstring (default colorstring is "black")

Examples:

turtle.pencolor("red")

turtle.pencolor("blue")

turtle.pencolor("yellow")

turtle.pencolor("blue")

turtle.pencolor("black")

turtle.pencolor("green")

turtle.circle(radius)

Draw a circle with given radius.

turtle.circle(radius, extent)

Draw a circle with given radius and extent – an angle – determines which part of the circle is drawn.

turtle.shape("turtle")

Sets the turtle shape to turtle.

turtle.undo()

Undo (repeatedly) the last turtle action(s)

turtle.clear()

Erases all drawings that currently appear in the graphics window.

turtle.begin_fill()

Starts the fill color

turtle.fillcolor(colorstring)

Examples:

turtle.fillcolor("red")

turtle.fillcolor("blue")

turtle.fillcolor("yellow")

turtle.fillcolor("blue")

turtle.fillcolor("black")turtle.fillcolor("green")

turtle.end_fill()

Ends the fill color