Help Activity refresh/Chapter/Turtle Art
About Turtle Art
Turtle Art, also known as Turtle Blocks, is an activity with a Logo-inspired graphical "turtle" that draws colorful art based on snap-together visual programming elements. Its "low floor" provides an easy entry point for beginners. It also has "high ceiling" programming, graphics, mathematics, and Computer Science features which will challenge the more adventurous student.
Where to get Turtle Art
http://activities.sugarlabs.org/en-US/sugar/addon/4027
Note: There are two inter-compatible programs: Turtle Art and Turtle Blocks. Turtle Art, which closely parallels the Java version of Turtle Art maintained by Brian Silverman, offers a small subset of the functionality of Turtle Blocks. This is the version included in the Sugar distribution. Sugar users probably want to use Turtle Blocks rather than Turtle Art. (Also see Turtle Confusion, a collection of programming challenges designed by Barry Newell.)
Using Turtle Art
File:Screenshot of "Turtle Art Activity" getting started.png
Start by clicking on (or dragging) blocks from the Turtle palette. Use multiple blocks to create drawings; as the turtle moves under your control, colorful lines are drawn.
You add blocks to your program by clicking on or dragging them from the palette to the main area. You can delete a block by dragging it back onto the palette. Click anywhere on a "stack" of blocks to start executing that stack or by clicking in the Rabbit (fast) , Turtle (slow) or Bug (debug) buttons on the Project Toolbar.
The basics
- TA-pensize.png
'set pen size' block
- Penupdown.jpg
'pen up' and 'pen down'
Drawing shapes
- Turtlesquare.jpg
Use the 'repeat' block to draw shapes
- Turtlepolygon.jpg
This can be generalised to n sided polygons, n is stored in 'box 1'
- Turtlefilledtriangle.jpg
Use 'start fill' and 'end fill' to draw filled shapes
- TA-sample4.png
There's no limit
Displaying things
- Hello world.jpg
Use 'print' to display in the print window
- TA-text.png
'show' block used to display at the turtle
- TA-image.png
'show' an image or video
- Showcamera.jpg
'show' the camera output
- Showsound.jpg
'show' plays sounds as well
- Printnumber.jpg
'print' and 'show' can display text or numbers including results of calculations
- Stringsandnumbers.jpg
'print' or 'show' mixed text and numbers, using '+'
- Speech.jpg
Text to speech. Load the Python block with the inbuilt sample code speak.py
Boxes, Stacks and the Heap
(aka variables, subroutines and the stack)
- TA-box-eample.png
Named variables: store a variable in 'box'
- Namedstacks.jpg
Named 'stacks' of blocks can be reused
- Collapsestack.jpg
Collapse a 'stack' of blocks to save space
- Pushpop.jpg
Store data in the first in last out heap using 'push' and 'pop'
- Turtlearray.jpg
Box names (and stack names) can be boxes, in this case 10 boxes are created. This is a powerful programming feature. A one dimensional array of variables has effectively been created.
Mathematics
- Mathoperators.jpg
Math operators including + - * / mod sqrt
- TA-if.png
Logical operations: flow control blocks accept >, <, =, and, not, or as input
- Pie2.png
Make pie charts [1]
- Coordinates.png
Cartesian and polar coordinate grids
- CM-coordinate-grid.svg
Centimeter coordinate grid (XO only)
Keyboard, mouse and sensor input
- Keyboardinput.jpg
Reading the keyboard
- Keyboard.png
Converting the keyboard output to a string
- Entertermnumber.jpg
Entering a multi digit number, exits with the number in 'box 1', [[2]]
- Turtlemouse.jpg
Load the Python block with the sample code push_mouse_event.py to read mouse events
- Printloudness.jpg
Read the microphone
- Resistance.jpg
Read sensors plugged into the microphone socket [3]