Handout
Handout
1
This is a handout to help you study this programming language
Commands:
1) Turtle.Show()
- An action.
- Makes the turtle appear.
- If not written before “other commands” it will not be considered wrong.
2) Turtle.Move(Distance)
- An action.
- Moves the turtle a specified distance.
3) Turtle.TurnLeft()
- An action.
- Turns the turtle 90 degrees to the left.
- Does not require a value.
4) Turtle.TurnRight()
- An action.
- Turns the turtle 90 degrees to right.
- Does not require a value.
5) Turtle. Turn(Angle)
- An action.
- Turn the turtle a specified degree.
- If you want, the turtle to turn clockwise write a positive angle, if you want it to
turn counter clockwise write a negative degree.
2
- Control the turtle’s speed.
- The valid values are 1 to 10 ( 1 is the slowest value and 10 is the fastest).
7) Turtle.PenUP()
- An action.
- Lifts the turtle’s pen up to stop it from writing while moving.
8) Turtle.PenDown()
- An action.
- Puts the pen down to allow the turtle to write while moving.
9) Turtle.Hide()
- An action.
- Hides the turtle from appearing.
3
The Graphics Window (Object):
1) GraphicsWindow.Title = “ title”
- A property.
- Sets the title for the GraphicsWindow.
- The quotation marks are very necessary if not written the program will not run due
to syntax error.
2) GraphicsWindow.Height = value
- A property.
- Sets the height for the GraphicsWindow.
3) GraphicsWindow.Width = value
- A property.
- Sets the width for the GraphicsWindow.
4)
GraphicsWindow.BackGroundColor= “color”
- A property.
- Sets the color for the background of the GraphicsWindow.
- Quotation mark is required.
5) GraphicsWindow.PenColor= “color”
- A property.
- Sets the color of the turtle’s pen.
- A property for the GraphicsWindow.
- Quotation mark is required.
4
6) GraphicWindow.GetRandomColor()
- An action.
- Sets a random color for the required property (PenColor and BackgroundColor).
- If not used as a value, it will not function.
Example:
GraphicsWindow.BackgroundColor = GraphicsWindow.GetRandomColor()
GraphicsWindow.PenColor = GraphicsWindow.GetRandomColor()
Notes:
- The Graphics Window as a property controls any tool carried by the turtle.
- Any change in the commands will stop the program from running due to a syntax
error.
- Commands are run by order, thus any command to change the look of the actions
(colors, shape) will only be apply to the commands bellow.
Example:
Turtle.Move(50)
GraphicsWindow.PenColor = “Brown”
The line drawn by the turtle will be black.
- Try reading the command and visualizing the movements done by it, to be able to
trace and draw every and each command.