Turtle Graphics - Pen and Background Control
[Index] [<< Previous section: Turtle and Window Control] [Next section: Stroking and Filling Paths >>]
pendownpd- Description: sets the pen down and the turtle resumes leaving a trail as it moves on the canvas.
penuppu- Description: sets the pen up and the turtle stops leaving a trail as it moves on the canvas.
penpaint- Description: (default) sets the drawing mode to PAINT.
penerase- Description: sets the drawing mode to ERASE.
- Example:
penerase
setpensize 30
fd 100- The result is shown bellow:
- Example:
setpencolor colorsetpc colorsetcolor color- Description: sets the stroke color (default: black). The
colorcan be set using standard color codes or html HEX values:- Examples:
setcolor "red
setcolor "4
setcolor "#ff0000- Standard color codes: 0: "black" (), 1: "blue" (), 2: "lime" (), 3: "cyan" (), 4: "red" (), 5: "magenta" (),
6: "yellow" (), 7: "white" (), 8: "brown" (), 9: "tan" (), 10: "green" (), 11: "aquamarine" (), 12: "salmon" (),
13: "purple" (), 14: "orange" (), 15: "gray" (). - Examples:
setpensize valuesetwidth valuesetpw value- Description: sets the pen size to a number of
valuepixels. setbgcolor color- Description: sets the background color of the canvas (note: draws a 500x500px square on the graphics canvas).
The
colorcan be set using standard color codes or html HEX values:- Example:
setbgcolor "green
setbgcolor "10
setbgcolor "#00ff00- The result is shown bellow:
- Standard color codes: 0: "black" (), 1: "blue" (), 2: "lime" (), 3: "cyan" (), 4: "red" (), 5: "magenta" (),
6: "yellow" (), 7: "white" (), 8: "brown" (), 9: "tan" (), 10: "green" (), 11: "aquamarine" (), 12: "salmon" (),
13: "purple" (), 14: "orange" (), 15: "gray" (). - Example:
setbgimg image- Description: sets a background image using the
imagename.- Some of the names are: "White", "Beach", "Field", "Winter", "Space", "Scene", etc. You can find all the available images using the Background image panel from the editor:
- Example:
setbgimg "Winter- The result is shown bellow:
- Some of the names are: "White", "Beach", "Field", "Winter", "Space", "Scene", etc. You can find all the available images using the Background image panel from the editor:
[Index] [<< Previous section: Turtle and Window Control] [Next section: Stroking and Filling Paths >>]