Difference between revisions of "Activities/Turtle Art"

From Sugar Labs
Jump to navigation Jump to search
Line 115: Line 115:
 
{{:Activities/TurtleArt/Toolbars}}
 
{{:Activities/TurtleArt/Toolbars}}
  
===Keyboard shortcuts===
+
{{:Activities/TurtleArt/Extras}}
* Ctrl+q quit (exit Turtle Art)
 
* Alt+p show/hide the palettes
 
* Alt+b show/hide the blocks
 
* Alt+r run the 'start' stack rapidly
 
* Alt+w run the 'start' stack slowly (and highlight blocks during execution)
 
* Alt+s stop execution of the stack
 
* Alt+e erase the screen
 
* Esc return from full-screen mode
 
* Ctrl+c copy a stack of blocks or text from a block
 
* Ctrl+v paste a stack of blocks or text into a block
 
* cursor (arrow) keys (or h j k l keys) move selected stack of blocks or turtle or move between toolbar items
 
* Return (Enter) is used to run a stack of blocks or to select a toolbar item
 
* space selects the next block (in the order in which they were added) (only in version 100+)
 
 
 
Note for OLPC-XO laptop users: the buttons on the display can also be used.
 
* The left-hand buttons can be used to move a stack of blocks or turtle
 
* o button runs the selected stack of blocks or returns the selected turtle to the home position (center of the screen)
 
* × button deletes the selected stack of blocks
 
* ✓ button runs the 'start' stack
 
* ◽ button selects the next block (in the order in which they were added) (only in version 100+)
 
  
 
===Helpful hints===
 
===Helpful hints===

Revision as of 19:25, 27 February 2011

english | español | HowTo [ID# 62490] 

What is Turtle Art

Turtle Art is an activity with a Logo-inspired graphical "turtle" that draws colorful art based on snap-together visual programming elements.

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.

Where to get Turtle Art

Activity-turtleart.png

Turtle Art is a Fructose module, so it is included as part of the standard Sugar (Sucrose = Glucose+Fructose) distribution.

Sugar Activity Library

Sources

Manuals & Guides

Galleries

Blogs

Other wiki pages

Release notes

Video

Bugs


i18n

Turtle Art currently has support for: de, el, en, es, fa_AF, fi, fr, hi, it, mn, nl, ps, pt, ru, sl, sv, ta, tr, vi, and zh_TW

(See our Pootle server for details about how to translate Turtle Art into your language.)

Reporting bugs

Please file bug reports here.

Background

Turtle Art is intended to be a stepping stone to the Logo programming language, but there are many restrictions compared to Logo. (Only numeric global variables and stack items are available, no lists or other data-structures. The conditionals and some of the functions only take constants or variables, not expressions. Limited screen real-estate makes building large programs unfeasible.) However, you can export your Turtle Art creations to Berkeley Logo.

Turtle Art was written by Brian Silverman and is maintained by Walter Bender. Arjun Sarwal added the sensor features. Luis Michelena contributed to the "named" action and box blocks. Tony Forster has been the lead test engineer and has really stretched the boundaries of Turtle Art. Raúl Gutiérrez Segalés has been a major contributor to the refactoring of the Turtle Art code base starting with Version 0.83.

Branches

A portfolio feature lets you use Turtle Art to create multimedia slide shows from material retrieved from your Journal. The basic idea is to import images (and eventually movies, audio, and text files) into slide templates, not unlike Powerpoint, and then show a presentation by stepping through them. The portfolio includes the typical major functions of presentation software: an editor that allows text to be inserted and formatted (this is largely incomplete), a method for inserting images (from the Journal), and a slide-show system to display the content. What makes it a bit different than tools such as Powerpoint is that you can program your slides using Turtle Art blocks. Turtle Art also has an export-to-HTML function so that presentations can be viewed outside of the Sugar environment. (These features have been merged into the main branch of Turtle Art.)

Turtle Art with Arduino

Turtle Art with Arduino support is an extension of Turtle Art that supports data capture from the Arduino board. This branch is maintained by Sayamindu Dasgupta and Rafael Ortiz.

Galleries

Play with Turtle Art to draw colorful art patterns using a turtle that accepts instructions for movement.

With visual programming blocks, you can snap together programs by compiling (combining) them in ways to create anything you can imagine.


Graphics

Media

Maths

Tony Forster describes his "adventures" with on-the-fly definitions to create an analog clock in his blog.

Try any of the time or math library functions, e.g.,

localtime().tm_min 
sin(x) + sin(pi/2)

Sensors

Turtle Art supports sensor input:

More ideas for sensors [[2]] [[3]]

Games

Turtle Art can be used to write games, such as a simple falling block game:

Presentations

Student work

Students from Caacupé have been sending me examples of their work:

Just for fun

Turtle Art Day 2013

More features

Getting Started

TAvertical.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) or Turtle (slow) buttons on the Project Toolbar.

Video Tutorials

I know there are a few but they are not categorized on this page... we'll make that happen soon. Help would be appreciated.


Toolbars

Main Toolbar

TAmain.png

From left to right:

  • Activity toolbar (includes sharing; saving/loading options);
  • Edit toolbar (including copy and paste);
  • View toolbar (including full-screen, coordinate overlays; turtle status, etc.);
  • Palette toolbar (including all programming blocks);
  • erase canvas;
  • run project fast (rabbit);
  • run project slow (snail);
  • hide blocks (This button is replaced by the stop button when the project is running);
  • help;
  • load examples;
  • stop activity
Note
Keyboard short cuts for the above: Alt+ palette; blocks; run; walk; stop; erase; e.g., Alt+e will erase the screen. Esc will return from full-screen mode.
Note
The run buttons are tied to the Start Block. If no Start Block is used, then all blocks are run when either run button is clicked.
Note
The "rabbit" button runs the blocks at maximum speed. The "snail" button pauses and displays the turtle and block values between each step.
Note
The Show-blocks.svg button, which is replaced by the Stop button on the main toolbar while the program is executing, is used to reveal the program blocks. Individual palettes can be hidden by clicking on their highlighted tab.
Note
On older versions of Sugar (e.g., 0.84), the main toolbar will look like this:

TA0.84.png

Project Toolbar

TurtleBlocks Toolbar 1.png

From left to right:

  • Project title;
  • Write to Journal (on newer versions of Sugar)
  • Keep button (not shown; only appears on older Sugar systems)
  • Share button;
  • Share blocks button used to share stacks of blocks between collaborators (shown in inactive state);
  • Save palette button (shows save options; see below);
  • Load palette button (shows load options; see below)
Note
On older Sugar systems, these controls appear on the Import/Export toolbar.
Note
To share a stack, click on the share button. The cursor will change to the hand shape Ta-hand-cursor.png. Place the cursor on any block or stack of blocks and click. The blocks will be shared and the cursor will change back to the arrow shape.

TurtleBlocks Toolbar 1a.png

TurtleBlocks Toolbar 1b.png

Edit Toolbar

TurtleBlocks Toolbar 2.png

The Edit toolbar is used to copy stacks of blocks to the clipboard and to paste stacks from the clipboard. To copy a stack, click on the copy button or type Ctrl-c. The cursor will change to the hand shape Ta-hand-cursor.png. Place the cursor on any block or stack of blocks and click. The blocks will be copied to the Sugar clipboard and the cursor will change back to the arrow shape. To paste from the clipboard, type Ctrl-v or click the paste button.

From left to right:

  • Copy;
  • Paste;
  • Undo (Restore blocks from trash);
  • Save stack to custom palette (use the hand cursor to select a stack to save, the stack of blocks must start with an "action" block);
  • Remove stack from custom palette (use the hand cursor to select a stack on the custom palette to delete)
Note
After save stack: To show the custom palette or see new stacks it is necessary to restart TurtleBlocks

View Toolbar

TurtleBlocks Toolbar 4.png

From left to right:

  • Full-screen button;
  • Cartesian-coordinate grid;
  • polar-coordinate grid;
  • not shown: centimeter-coordinate grid (XO-only);
  • Rescale-coordinates button (There are two modes: one pixel-based and one scaled from -20 to 20);
  • Grow block size;
  • Shrink block size
  • Disable/enable hover help
  • display of x,y coordinates, heading of turtle;

Palettes Toolbar

The palette menus are revealed by clicking on the Block icon on the main toolbar. (On older Sugar systems, select the Projects toolbar. When running Turtle Art from GNOME, the palettes are visible by default.)

TurtleBlocks Toolbar 5.png

There are ten palettes of program elements available for program construction: Turtle movements; Pen attributes; Color attributes; Numeric operators; Logical operators; Logical blocks; Sensor blocks; Media blocks; Customization functions; and Presentation blocks. An eleventh palette is used for restoring blocks from the trash.

Note
Additional palettes may be loaded by plugin extensions to Turtle Blocks.
Note
A custom palette is created if you use the 'save stack' button on the Edit toolbar.
Note
Blocks are dragged from the palette onto the canvas surface. To dispose of a block, drag it back onto the palette. (It will be placed onto the trash palette.)
Note
The palettes can be displayed horizontally or vertically (See below). Orientation is adjusted by clicking on the TAorientation0.svg and TAorientation1.svg buttons on the upper-left corner of the palette.
Note
The palette can be hidden by clicking on the TAhide.svg button on the lower-right corner of the palette.
Note
The next palette in the menu can be accessed by clicking on the TAnext.svg button on the upper-right corner of the palette.
Note
On smaller screens, a palette may not fit. It can be scrolled by clicking on the TAscroll.svg button.

Turtle Palette

TAturtle.png

These blocks are used to control the movements of the turtle.

  • forward: move turtle forward
  • back: move turtle backward
  • clean: clear the screen and position the turtle in the center of the screen, pen down, color red, heading 0
  • left: rotate turtle counterclockwise
  • right: rotate turtle clockwise
  • arc: move turtle along an arc
  • set xy: set turtle x,y position (0,0) is the center of the screen
  • seth: set turtle heading
  • xcor: holds current x-coordinate value of the turtle (can be used in place of a number block)
  • ycor: holds current y-coordinate value of the turtle (can be used in place of a number block)
  • heading: holds current heading value of the turtle (can be used in place of a number block)

Pen Palette

TApen.png

These blocks are used to control the attributes of the turtle's pen.

  • pen up: turtle will not draw when moved
  • pen down: turtle will draw when moved
  • set pen size: sets the width of the line drawn by the turtle
  • fill screen: fill the screen with a color/shade and reposition the turtle in the center of the screen
  • pen size: width of the line drawn by the turtle (can be used in place of a number block)
  • set color: sets the pen color
  • set shade: sets the pen shade
  • set gray: sets the gray-level of the pen (Only available in Turtle Blocks)
  • color: current pen color (can be used in place of a number block)
  • shade: current pen shade (can be used in place of a number block)
  • gray: current pen gray level (can be used in place of a number block) (Only available in Turtle Blocks)
  • start fill: starts a filled polygon (straight sides, not arcs)
  • end fill: ends a fill polygon (straight sides, not arcs)

Color Palette

TAcolors.png

These blocks can be used with the set-pen-color block in place of a number block.

Numbers Palette

TAnumbers.png

These blocks are arithmetic and boolean operators.

  • addition: adds two numeric inputs (also can be used to concatenate strings)
  • subtraction: subtracts the bottom numeric input from the top input
  • multiplication: multiplies two numeric inputs
  • division: divided top input (numerator) by bottom input (denominator)
  • identity: identity function (used for spacing blocks)
  • modulo (remainder): calculates remainder when dividing top input by the bottom input
  • square root (Only available with Turtle Blocks)
  • random number: generates a random integer between the minimum and maximum values
  • number block: a numeric input
  • greater than: boolean greater than operator (used with flow blocks)
  • less than: boolean less than operator (used with flow blocks)
  • equal to: boolean equal to operator (used with flow blocks)
  • not: boolean not (Only available with Turtle Blocks)
  • and: boolean and (Only available with Turtle Blocks)
  • or: boolean or (Only available with Turtle Blocks)

Flow Palette

TAflow.png

These blocks control program flow.

  • wait: pause program execution (unit is seconds)
  • forever: continuously repeat execute stack under the right flow
  • repeat: repeat the execution of stack under the right flow a specified number of times
  • if/then: conditional execution of the stack under the right flow (uses boolean operators found on the Number palette)
  • if/then/else: conditional execution of the stack under the center and right flows (uses boolean operators found on the Number palette)
  • vertical spacer
  • stop stack: interrupt execution
  • while: execute stack under right flow while the condition is true (uses boolean operators found on the Number palette) (Only available with Turtle Blocks)
  • until: execute stack under right flow until the condition is true (uses boolean operators found on the Number palette) (Only available with Turtle Blocks)

Note: Nesting while and/or until blocks is not always reliable. If you encounter an error, try putting the nested block in a separate stack, accessed with an action block.

Blocks Palette

TAblocks.png

These blocks are for defining variables and subroutines. Without actions

  • start: connects action to toolbar 'Run' button
  • store in: store a number, string, or media object in a named box
  • action: top of named action stack
  • action: execute named action stack

Note: When a named action or named box block are used, new blocks appear on the palette that correspond to these names; e.g., if a top of action stack is rename, "to square", an action block, "to square" is added to the palette.

TAblocks yes.png

Palette with additional actions and boxes created by the user.

Sensors Palette

TAsensors.png

  • query keyboard: check for keyboard input (results are stored in the keyboard block)
  • keyboard: current value of keyboard input (can be used in place of a number block)
  • read pixel: push the RGB value of the pixel under the turtle onto the FILO (blue is first, red is last)
  • turtle sees: the "palette color" of the pixel under the turtle
  • time: number of seconds since program began
  • sound: raw data from microphone ranging -32000 to 32000
  • volume (loudness): ranging 0 to 32000
  • pitch: the resolution is +-8Hz
  • brightness: average luminance seen through camera
  • button down: current state of the mouse button (1 == down; 0 == ip)
  • mouse x: x position of mouse
  • mouse y: y position of mouse

The OLPC XO can measure external inputs with its microphone jack:

  • resistance: measurement range is 750 to 14k ohms, (OLPC XO1) and 2k ohms to open circuit (OLPC XO1.5)
  • voltage: measurement range is DC 0.4V to 1.85V. (OLPC XO1) and 0.17V to 3.0V (OLPC XO1.5)

The OLPC XO 1.75 also includes an accelerometer.

  • accelerate (not shown): measure the acceleration of the computer. Results are pushed to the stack and can be retrieved by using 3 'pop' blocks (one for X (horizontal), one for Y (vertical), and one for Z (forward/backward))

See Activities/Turtle Art/Using Turtle Art Sensors for more details about the sensor blocks.

(Activities/Turtle Art/Uso de Tortuga Arte Sensores español)

Media Palette

TAmedia.png

These are a collection of blocks used for displaying media objects, such as images from the Journal.

  • journal: Sugar Journal media object (used with show block) (also available in Turtle Art)
  • audio: Sugar Journal media object (used with show block)
  • video: Sugar Journal media object (used with show block)
  • description: Sugar Journal description field (used with show block)
  • text: text string (used with show block; also used with box and action blocks)
  • show: draw text or display media object from the Journal
  • set scale: sets the scale of images displayed with show block
  • save picture: save the canvas to the Sugar Journal as a .png image (note: saves the canvas as displayed)
  • save SVG: save turtle graphics to the Sugar Journal as a .svg image (note: only saves the changes to the canvas in the current execution run)
  • scale: sets scale for show block (100% is full-screen)
  • media wait: used to pause program while audio or video file plays
  • media stop: stop current sound or video
  • media pause: pause current sound or video
  • media resume: resume playing paused media
  • speak: sends text to the voice synthesizer
  • sine wave: plays a sine wave of a given frequency, amplitude, and duration

Extras Palette

TAextras.png

These are a collection of extra blocks for accessing advanced features only available in Turtle Blocks.

  • push: push value onto FILO (first-in last-out) heap
  • show heap: show FILO in status block
  • empty heap: empty the FILO
  • pop: pop value off of the FILO (can be used in place of a number block)
  • print: print value in status block (also available in Turtle Art)
  • comment: program comment (displayed in "walk" mode)
  • chr: Python chr primitive: converts ASCII to character (useful for converting keyboard input to text)
  • int: Python int primitive: converts input to integers
  • Python: a programmable block (can be used in place of a number block)
add your own math equation in the block, e.g., sin(x); This block is expandable to support up to three variables, e.g. f(x,y,z)
  • Import Python: import Python code from the Sugar Journal (a more general-purpose programmable block). This block accepts a single variable x, as an input or up to 3 variables as an array x[0], x[1] and x[2]
  • Cartesian: display Cartesian coordinate grid overlay
  • polar: display polar coordinate grid overlay
  • turtle: specify which turtle is active
  • turtle shell: import a image from the Journal to use as the turtle's 'shell', i.e., replace the turtle with a sprite.
  • turtle x: Return x coordinates of turtle
  • turtle y: Return y coordinates of turtle
  • active turtle: the name of active turtle
  • turtle heading: Return heading of turtle
  • URL: gets a text string or image from a URL

Portfolio Palette

TAportfolio.png

These blocks are used to make multimedia presentations only available in Turtle Blocks.

  • hide blocks: hides all blocks and palettes (useful for decluttering the screen during presentations) (also available in Turtle Art)
  • show blocks: shows blocks and palettes (useful for resuming programming after a presentation)
  • full screen: goes into full-screen mode (hides Sugar toolbars)
  • list slide: used for bulleted lists; This block is expandable, allowing you to add as many bullets as you need
  • picture slides: used for picture slides (1×1, 2×2, 1×2, and 2×1)

Only available in Turtle Blocks:

  • left: holds current x-coordinate value of the left edge of the screen (can be used in place of a number block)
  • top: holds current y-coordinate value of the top edge of the screen (can be used in place of a number block)
  • right: holds current x-coordinate value of the right edge of the screen (can be used in place of a number block)
  • bottom: holds current y-coordinate value of the bottom edge of the screen (can be used in place of a number block)
  • width: screen width (can be used in place of a number block)
  • height: screen height (can be used in place of a number block)
Note: The slide blocks expand into stacks that can be edited for customized presentations.

User custom-stack palette

TAStack.png

The custom palette holds any blocks that have been saved with "Save Stack" option in Edit Toolbar. It lets you reuse stacks between projects. Blocks on this palette will expand into action stacks.

Note
This palette first appears after using the "Save stack" option on the Edit Toolbar.

Trash Palette

TAtrash.png

This palette holds any blocks that have been put in the trash. You can drag blocks out of the trash to restore them. The trash palette is emptied when you quit Turtle Art.

Vertical palettes

TAvertical.png

An example of a vertical palette. Vertical palettes are used by default on the OLPC XO laptops running older versions of Sugar.

Palettes en español

Extras

Keyboard shortcuts

  • Ctrl+q quit (exit Turtle Art)
  • Alt+p show/hide the palettes
  • Alt+b show/hide the blocks
  • Alt+r run the 'start' stack rapidly
  • Alt+w run the 'start' stack slowly (and highlight blocks during execution)
  • Alt+s stop execution of the stack
  • Alt+e erase the screen
  • Esc return from full-screen mode
  • Ctrl+c copy a stack of blocks or text from a block
  • Ctrl+v paste a stack of blocks or text into a block
  • cursor (arrow) keys (or h j k l keys) move selected stack of blocks or turtle or move between toolbar items
  • Return (Enter) is used to run a stack of blocks or to select a toolbar item
  • space selects the next block (in the order in which they were added) (only in version 100+)

Note for OLPC-XO laptop users: the buttons on the display can also be used.

  • The left-hand buttons can be used to move a stack of blocks or turtle
  • o button runs the selected stack of blocks or returns the selected turtle to the home position (center of the screen)
  • × button deletes the selected stack of blocks
  • ✓ button runs the 'start' stack
  • ◽ button selects the next block (in the order in which they were added) (only in version 100+)

Copying and Pasting

Did you know that you can copy/paste stacks to/from the clipboard? You type Ctrl-C to copy whatever stack is under the cursor to the clipboard. Ctrl-V will paste from the clipboard onto whatever TA project you have open. Try pasting this code into your Turtle Art project.

[[0, "clean", 258, 217, [12, 1]],
 [1, "repeat", 258, 251, [0, 2, 3, null]],
 [2, ["number", 36], 309, 251, [1, null]],
 [3, "repeat", 323, 311, [1, 4, 5, 9]],
 [4,  ["number", 4], 374, 311, [3, null]],
 [5, "forward", 388, 371, [3, 6, 7]],
 [6, ["number", 300], 459, 371, [5, null]],
 [7, "right", 388, 413, [5, 8, null]],
 [8, ["number", 90], 446, 413, [7, null]],
 [9, ["vspace", 20], 323, 389, [3, 10]],
 [10, "right", 323, 463, [9, 11, null]],
 [11, ["number", 10], 381, 463, [10, null]],
 [12, "start", 258, 175, [null, 0]]]

You can also paste text from the clipboard into text blocks.

Note: You can duplicate individual blocks with copy and paste, when duplicating a text block, deselect the text block after copying if you want to duplicate the block rather than duplicating the text within the block.

Speed

Turtle Art has three 'run' buttons:

  • The 'rabbit' button will run your program at full screen. Note: It will highlight blocks during execution, so your program will run much faster if you hide blocks.
  • The 'turtle' button will run your program with a slight delay between blocks. Block are highlighted as they are executed and block labels are updated with the current block values.
  • The 'debug' button will run your program with a longer delay between blocks. Block are highlighted as they are executed and block labels are updated with the current block values.

Sharing

Turtle Art supports a simple sharing model. Whomever joins a shared activity will share turtles with the other participants, e.g., whatever any turtle draws will appear on every screen. While sharing, you can also send stacks of blocks from one user to another. Share can consume a lot of network bandwidth, so it is not recommended to share among more than 2–3 people at a time if the screen is frequently changing. As with all Sugar activities, you can use the Share-with feature of the Journal to share your Turtle Art projects with others.

A simple application of Turle Art sharing is multimedia chat. Send text using the Show Block; voice using the Speak Block; and images using the Show Block. Lots of fun.

Note: Turtle Art will also share between Sugar and GNOME.

Running Turtle Art outside of Sugar

TAGnome.png

Turtle Art can be run in the GNOME desktop outside of Sugar.

PC HARDWARE:

  • Download Turtle Art (as a *.xo archive)
  • Extract the TurtleArt.activity directory from the archive, eg drag it to the desktop
  • Open directory TurtleArt.activity
  • Run turtleart.py (run in terminal is better, you can see error messages there)

OLPC XO HARDWARE

  • The XO1.5 and later software builds for the XO1.0 allow switching between Gnome and Sugar desktops. The following assumes that Turtle Art is already installed in Sugar.
  • Switch to the Gnome desktop
  • open olpc's home on the desktop
  • open Activities
  • on later software builds, Activities is both hidden and locked, if so, check show hidden files to unhide, in terminal chmod 777 Activities to unlock
  • open TurtleArt.activity
  • run turtleblocks.py (run in terminal is better, you can see error messages there)

COMMAND LINE SWITCHES

turtleblocks --help
	turtleblocks.py
	turtleblocks.py project.tb
	turtleblocks.py --output_png project.tb
	turtleblocks.py -o project
	turtleblocks.py --run project.tb
	turtleblocks.py -r project

Helpful hints

Copying and Pasting

Did you know that you can copy/paste stacks to/from the clipboard? You type Ctrl-C to copy whatever stack is under the cursor to the clipboard. Ctrl-V will paste from the clipboard onto whatever TA project you have open. Try pasting this code into your Turtle Art project.

[[0, "clean", 258, 217, [12, 1]], [1, "repeat", 258, 251, [0, 2, 3, null]], [2, ["number", 36], 309, 251, [1, null]], [3, "repeat", 323, 311, [1, 4, 5, 9]], [4, ["number", 4], 374, 311, [3, null]], [5, "forward", 388, 371, [3, 6, 7]], [6, ["number", 300], 459, 371, [5, null]], [7, "right", 388, 413, [5, 8, null]], [8, ["number", 90], 446, 413, [7, null]], [9, ["vspace", 20], 323, 389, [3, 10]], [10, "right", 323, 463, [9, 11, null]], [11, ["number", 10], 381, 463, [10, null]], [12, "start", 258, 175, [null, 0]], [-1, ["turtle", 1], 0, 0, 0.0, 0, 50, 5]]

You can also paste text from the clipboard into text blocks.

Note: You can duplicate individual blocks with copy and paste, when duplicating a text block, deselect the text block after copying if you want to duplicate the block rather than duplicating the text within the block.

Speed

Turtle Art has three 'run' buttons:

  • The 'rabbit' button will run your program at full screen. Note: It will highlight blocks during execution, so your program will run much faster if you hide blocks.
  • The 'turtle' button will run your program with a slight delay between blocks. Block are highlighted as they are executed and block labels are updated with the current block values.
  • The 'debug' button will run your program with a longer delay between blocks. Block are highlighted as they are executed and block labels are updated with the current block values.

Running Turtle Art outsde of Sugar

TAGnome.png

Turtle Art can be run in the GNOME desktop outside of Sugar.

PC HARDWARE:

  • Download Turtle Art (as a *.xo archive)
  • Extract the TurtleArt.activity directory from the archive, eg drag it to the desktop
  • Open directory TurtleArt.activity
  • Run turtleart.py (run in terminal is better, you can see error messages there)

OLPC XO HARDWARE

  • The XO1.5 and later software builds for the XO1.0 allow switching between Gnome and Sugar desktops. The following assumes that Turtle Art is already installed in Sugar.
  • Switch to the Gnome desktop
  • open olpc's home on the desktop
  • open Activities
  • on later software builds, Activities is both hidden and locked, if so, check show hidden files to unhide, in terminal chmod 777 Activities to unlock
  • open TurtleArt.activity
  • run turtleart.py (run in terminal is better, you can see error messages there)

New features V83 and above

Presentations and Portfolios

A portfolio feature lets you use Turtle Art to create multimedia slide shows from material retrieved from your Journal. The basic idea is to import images (and eventually movies, audio, and text files) into slide templates, not unlike Powerpoint, and then show a presentation by stepping through them. The portfolio includes the typical major functions of presentation software: an editor that allows text to be inserted and formatted (this is largely incomplete), a method for inserting images (from the Journal), and a slide-show system to display the content. What makes it a bit different than tools such as Powerpoint is that you can program your slides using Turtle Art blocks. Turtle Art also has an export-to-HTML function so that presentations can be viewed outside of the Sugar environment. (These features have been merged into the main branch of Turtle Art.)

Background

In the era of high-stakes testing, we have the means to measure “which child knows more”; these data tell us about relative merit of the school in which a child is enrolled. The Turtle Art portfolio feature is an assessment tool that shows “what a child knows”; children become the curators of their own work. They advance their own learning and help their teachers, parents, and school administrators understand better the depth and breadth of what they have learned.

A recent article in the Chronicle of Higher Education claims:

  1. ePortfolios can integrate student learning in an expanded range of media, literacies, and viable intellectual work;
  2. ePortfolios enable students to link together diverse parts of their learning including the formal and informal curriculum;
  3. ePortfolios engage students with their learning;
  4. ePortfolios offer colleges a meaningful mechanism for accessing and organizing the evidence of student learning.

Turtle Art portfolios engage children in the process of reflecting on their work—what they have done, how they have done it, and how success these efforts have been—as they create a multimedia narrative to show their teachers, parents and peers what they have learned. Turtle Art Portfolio builds upon the journaling functionality of the Sugar learning platform, where every action or activity a child takes in the classroom is automatically recorded in a folder: (1) by enabling the child to select important learning achievements, be they in reading, writing, arithmetic, arts, music, physical education, history and social science, etc. Children answer questions such as “I chose this piece because...” (2) creating a multimedia narrative presentation from their selections (including audio voice-overs and video), reflective of the multiple ways in which children learn; and (3) sharing their presentation with classmates, both to celebrate what they have learned, but also to engage in a critical dialog about their work.

Turtle Art portfolio is innovative in three ways: (1) it builds upon a journal of *all* learning activities that is automatically collected; (2) it has unique programmability, fun and accessible to even the youngest elementary school children, but interesting and engaging to middle-school children as well; and (3) it has unique tools for both collaborating on the construction of the portfolio and its subsequent sharing with others.

Portfolios have been shown to be “a powerful means for children to assess their own work, set goals, and take responsibility for their future learning.” But portfolio assessment has seen limited applicability. It is a practical, engaging means to using portfolios. By building upon the automatic accumulation of work in journal (including a “screen capture” of their work) the portfolio process can readily be integrated into the classroom routine. Reflection becomes the norm: children are encouraged write in their journals (young children record audio notes) for a few minutes after *every* class. The numbing question, “what did you do in school today?” need no longer a necessary part of the parent-child dialog. Instead, the parent can talk to the child about actual artifacts.

Culling from the journal becomes part of the end-of-term assessment process. The process of telling one's story as a learning requires further reflection. At a “portfolio social”, parents are invited to view presentations and ask children about their learning; the child's voice is heard.

The classroom teacher can add addition assessment slides to the portfolio about themes such as work habits and personal growth, as part of an archive that travels with a child across grade levels. Through juxtaposition, the child and teacher can see what has changed over the course of the years, trends, and areas for improvement, Also, a classroom portfolio can be assembled as part of a teacher-assessment process.

Some additional background on ePortfolios can be found here:

Sharing a presentation

From version 106, pen trails, fill, show text and show images are shared with other laptops in a shared session. Screen erase is not shared. A slideshow can be broadcast to other laptops. Its simple, just these 2 blocks are required to broadcast a slide to all the laptops in the shared session.

Show-media.jpg

Use set scale to set image size. Full screen images take longer than smaller images. See below for using the keyboard to advance slides and other presentation ideas.

Quick Tutorial on using the portfolio features

A video of the portfolio basics is available here.

A PDF of a Turtle Art portfolio presentation can be downloaded File:Desktop-Summit.pdf.

Sharing

Turtle Art supports a simple sharing model. Whomever joins a shared activity will share turtles with the other participants, e.g., whatever any turtle draws will appear on every screen. (Please note that the "show" block is not shared, so it is not possible to share multimedia objects.) Share can consume a lot of network bandwidth, so it is not recommended to share among more than 2–3 people at a time. As with all Sugar activities, you can use the Share-with feature of the Journal to share your Turtle Art projects with others.

Note: as of Version 83, Turtle Art will not share correctly with older versions.

Note: as of Version 106, Turtle Art will share between Sugar and GNOME.

Turtle Art can export its projects to Berkeley Logo (using either View Source or the Save as Logo button on the Project Toolbar) You can download the Berkeley Logo activity here.

Logo code generated from your project is viewable in the View Source panel in some versions of Turtle Art, but as of v100, the Turtle Art project itself is shown instead.

Note: The Save-as-Logo button saves to the Journal as "logosession.lg". UCB Logo does not yet access the Journal directly, so it is necessary to copy the project out of the Journal using the "copy-from-journal" command in the Terminal Activity and then accessing the project using the File menu within the UCB Logo Activity.

copy-from-journal logosession.lg

Alternatively, you can open the logosession in 'Write', copy the Logo code to the clipboard, and then paste it into the UCB Logo Activity.

Shown here is the Logo code generated from the Turtle Art project shown above.

Firstly the Logo code contains procedures for setting up the palette and the shade functionality:

to tasetpalette :i :r :g :b :myshade
make "s ((:myshade - 50) / 50)
ifelse lessp :s 0 [
make "s (1 + (:s *0.8))
make "r (:r * :s) 
make "g (:g * :s) 
make "b (:b * :s)
] [
make "s (:s * 0.9)
make "r (:r + ((100-:r) * :s)) 
make "g (:g + ((100-:g) * :s)) 
make "b (:b + ((100-:b) * :s))
]
setpalette :i (list :r :g :b)
end
to rgb :myi :mycolors :myshade
make "myr first :mycolors
make "mycolors butfirst :mycolors
make "myg first :mycolors
make "mycolors butfirst :mycolors
make "myb first :mycolors
make "mycolors butfirst :mycolors
tasetpalette :myi :myr :myg :myb :myshade
output :mycolors
end
to processcolor :mycolors :myshade
if emptyp :mycolors [stop]
make "i :i + 1
processcolor (rgb :i :mycolors :myshade) :myshade
end
to tasetshade :shade
make "myshade modulo :shade 200
if greaterp :myshade 99 [make "myshade (199-:myshade)]
make "i 7
make "mycolors :colors 
processcolor :mycolors :myshade
end
to tasetpencolor :c
make "color modulo round :c 100
setpencolor :color + 8
end
make "colors [
100 0 0 100 5 0 100 10 0 100 15 0 100 20 0 100 25 0 100 30 0 100 35 0 100 40 0 100 45 0 
100 50 0 100 55 0 100 60 0 100 65 0 100 70 0 100 75 0 100 80 0 100 85 0 100 90 0 100 95 0 
100 100 0 90 100 0 80 100 0 70 100 0 60 100 0 50 100 0 40 100 0 30 100 0 20 100 0 10 100 0 
0 100 0 0 100 5 0 100 10 0 100 15 0 100 20 0 100 25 0 100 30 0 100 35 0 100 40 0 100 45 
0 100 50 0 100 55 0 100 60 0 100 65 0 100 70 0 100 75 0 100 80 0 100 85 0 100 90 0 100 95 
0 100 100 0 95 100 0 90 100 0 85 100 0 80 100 0 75 100 0 70 100 0 65 100 0 60 100 0 55 100 
0 50 100 0 45 100 0 40 100 0 35 100 0 30 100 0 25 100 0 20 100 0 15 100 0 10 100 0 5 100 
0 0 100 5 0 100 10 0 100 15 0 100 20 0 100 25 0 100 30 0 100 35 0 100 40 0 100 45 0 100 
50 0 100 55 0 100 60 0 100 65 0 100 70 0 100 75 0 100 80 0 100 85 0 100 90 0 100 95 0 100 
100 0 100 100 0 90 100 0 80 100 0 70 100 0 60 100 0 50 100 0 40 100 0 30 100 0 20 100 0 10]
make "shade 50
tasetshade :shade
to tasetbackground :color :shade
tasetshade :shade
setbackground :color + 8
end

Then the Logo code contains the project:

to ta
clearscreen tasetbackground 21 100 setpensize 25.0 make "box1 0.0 
repeat 300.0 [ tasetpencolor xcor / 6.0 tasetshade heading forward :box1 right 91.0 make "box1 :box1 + 1.0 ] 
end
ta

Looking under the hood

Turtle Art projects are stored as a .ta file contains a json-encoded serialization of the project.

The json encoding of a repeat 4 forward 100 right 90 project:

[[0,"repeat",331,158,[null,1,2,null]],[1,["number","4"],417,167,[0,null]],[2,"forward",426,207,[0,3,4]],[3,["number","100"],500,216,[2,null]],[4,"right",426,246,[2,5,null]],[5,["number","90"],500,255,[4,null]],[-1,"turtle",0,0,0,0,50,5]]

The basic structure of the encoding is a list of lists, where each block has these elements:

  1. block number
  2. block name or [block name, block value]
  3. x position (depreciated)
  4. y position (depreciated)
  5. list of connections to other blocks

Turtles are encoded at the end of the list:

  1. -1
  2. turtle or [turtle, turtle name]
  3. x position
  4. y position
  5. heading
  6. pen color
  7. pen shade
  8. pen width

Activities/TurtleArt/ProgrammableBrick

From the field

Tony Forster has written a number of blog posts about his experiments with Turtle Art:

An bringing it all together, the Turtle Art Oscilloscope.

Untitled.jpg

Tony has also used the programmable block to do file IO.


Turtle Art Arduino

Andrés Aguirre is part of the Butiá team in Montevideo:

We have released the 1.0 version of the sources, which has full integration with tortugarte (http://www.fing.edu.uy/inco/proyectos/butia/publicaciones.html). Last month we gave away nearly 30 Butiá robots in a robotic event organized by the University. These robots were given to secondary schools throughout the country, in this event we gave some tutorials and exercises to do with our help. One of the schools made a great line follower in tortugarte ;) : http://www.youtube.com/watch?v=Szp0LWLyPIg Then on the second day we give some tutorials and some children really enjoyed the experience, like Pedro a 10 year old child who really has programming skills! http://www.flickr.com/photos/butiarobot/5059177334/ http://www.youtube.com/aguirrea#p/u/7/p0y11iyhFko
In future months we will go to the schools where we give the robots to continue teaching and giving new challenges. If you would like to see more about Butiá, we have a flickr site: http://www.flickr.com/photos/butiarobot/ and also a web page: http://www.fing.edu.uy/inco/proyectos/butia

Modifying Turtle Art

Turtle Art is under the MIT license. You are free to use it and learn with it. You are also encourage to modify it to suit your needs or just for a further opportunity to learn.

Much of the motivation behind the Version 83 refactoring of the code was to make it easier for you to make changes. Most changes can be confined to two modules: taconstants.py and talogo.py. The former defines the blocks and palettes; the latter defines what code is executed by a block.

Note: As of Version 106, there is also support for plugins. If you can use the plugin mechanism to add support for additional devices, e.g., Arduino, or for making modifications such as are described below without making changes to the standard code base. (The advantage to the latter is that your changes will remain intact even after you upgrade to a newer version.)

taconstants.py contains the constants that by-in-large determine the behavior of Turtle Art. Notably, the block palettes are defined below. If you want to add a new block to Turtle Art, it is generally a matter of modifying some tables below and then adding the primitive to talogo.py. For example, if we want to add a new turtle command, 'uturn', we'd make the following changes:

(1) We'd add 'uturn' to the PALETTES list of lists:

PALETTES = [['forward', 'back', 'clean', 'left', 'right', 'show', 
             'seth', 'setxy', 'heading', 'xcor', 'ycor', 'setscale',
             'arc', 'scale', 'left', 'top', 'right', 'bottom', 'uturn'],
            ['penup','pendown', 'setpensize', 'fillscreen', 'pensize',...

(2) Then we'd add it to one of the block-style definitions. Since it takes no arguments, we'd add it here:

BASIC_STYLE = ['clean', 'penup', 'pendown', 'stack1', 'stack2', 'vspace',
   'hideblocks', 'showblocks', 'clearheap', 'printheap', 'kbinput', 'uturn']

(3) Then we give it a name (Note the syntax _('string to be translated') used by the language-internationalization system; also note that the name is an array, as some blocks contain multiple strings.):

BLOCK_NAMES = {
...
   'uturn':[_('u-turn')],
...
             }

(4) and a help-menu entry:

HELP_STRINGS = {
...
   'uturn':_('change the heading of the turtle 180 degrees'),
...
              }

(5) Next, we need to define it as a primitive for the Logo command parser (generally just the same name):

PRIMITIVES = {
...
   'uturn':'uturn',
...
            }

(6) Since there are no default arguments, we don't need to do anything else here. But we do need to define the actual function in talogo.py

DEFPRIM = {
...
   'uturn':[0, lambda self: self.tw.canvas.seth(self.tw.canvas.heading+180)],
...
         }

That's it. When you next run Turtle Art, you will have a 'uturn' block on the Turtle Palette.

TAuturn.png

Adding a new palette is simply a matter of: (1) adding an additional entry to PALETTE_NAMES; (2) new list of blocks to PALETTES; and (3) an additional entry in COLORS. However you will have to: (4) create icons for the palette-selector buttons. These are kept in the icons subdirectory. You need two icons: yourpalettenameoff.svg and yourpalettenameon.svg, where yourpalettename is the same string as the entry you added to the PALETTE_NAMES list. Note that the icons should be the same size (55x55) as the others. This is the default icon size for Sugar toolbars.