Command |
What It Does |
|
Necessary at start of program |
|
Put at very end of program (keeps window from auto-closing) |
|
--- Colors & Sizes --- |
turtle.setup(width, height)
|
Set window size (in pixels) |
|
Set window background color |
|
Set pen thickness (in pixels) |
turtle.pencolor('color')
|
Set pen color |
|
--- Turtle Management --- |
|
Raise pen (to move without drawing) |
|
Lower pen (to resume drawing) |
|
Hides turtle (does not affect drawing) |
|
Displays turtle |
|
--- Input via Dialog Box --- |
var = turtle.textinput ('title', 'prompt')
|
Assigns user's input to the variable as a string |
var = turtle.numinput ('title', 'prompt')
|
Assigns user's input to the variable as a float |
var = turtle.numinput ('t', 'p', default=x, minval=y, maxval=z)
|
Optional arguments: x = default value displayed in input box y = reject any number less than y z = reject any number greater than z |
|
--- Movement & Positioning --- |
|
moves turtle n distance in direction it's currently facing |
|
Set turtle's heading to a specific angle (90 is up) |
|
Turn n degrees to the right |
|
Turn n degrees to the left |
|
Move turtle to specific coordinates |
|
Displays turtle's current coordinates |
|
--- Drawing & Writing --- |
turtle.fillcolor('color')
|
Set color for filling shape |
|
Use before drawing shape to be filled |
|
Use after shape has been drawn |
|
Draw a circle with specified radius |
|
Draw a simple dot at current location |
|
Writes text, with lower left corner of 1st character at turtle's coordinates |
|
--- Erasing & Undoing --- |
|
Erases all drawing, but doesn't reset turtle position, pen color, or background color |
|
Clears/resets everything except window background color |
|
Clears/resets everything |