Turtlet, Kilppari in Finnish, is an educational
visualization tool aimed for the introductory programming courses. Kilppari offers lecture aid as a visualization tool
on the basic
programming constructs and as a Python-programming exercise. The tool is constructed so that it can be utilized also as a larger project assignment for novice programmers. The newest version also has an option to connect and steer a purpose-build robot, which can be further used to demonstrate how computers can control electronics and manipulate the environment around them.
Here is a short 3 minute introductory movie concerning the basic concepts of Turtlet (video does not start automatically, right-click and select play).:
Here is the download link for the video
if you cannot
view embedded video objects. (3 min, ~11 MB)
Lecture visualization: Turtlet offers easy-to-use interface to allow quick demonstrations on basic programming constructs like iteration or logical decisions.
Programming interface: Turtlet uses standard Python 2 source code to create visualization. This visualization interface is programmable so students can create their own visualization commands and test new concepts. This also enables Turtlet to be applicable as a programming exercises.
Visual feedback: Several students from the test groups lauded the tool because "it allows me to see what my code actually does tell the visualization module to do".
Platform independence: As the Turtlet is
build with Python, it can be used in any environment that has complete Python interpreter, such as all PC operating
systems, most new mobile phones and handheld devices.
Turtlet has two distinct interfaces. The standard interface is the parser interface, where students can enter textual commands. This interface operates as demonstrated in the video:
On the left window, user inserts commands they wish to execute. You may enter multiple commands at once, but they must be separated to each in their own lines.
Clicking "Engage" starts the visualization.
Previous commands and error messages appear on the right window.
Please notice, that the current English version is not
complete translation, but merely a demonstration version. Therefore the command base is not translated, and currently the system
only allows step, step N, right, left and square as an english commands. The Finnish command base found in the documentation
(Help->Commands) is also available.
Secondary interface is the button interface, which can be opened by selecting File->Open Interface->Buttons.
In this interface, user just presses the buttons to operate
This interface is not designed to be programmable, so student users do not need to be able to modify this interface.
Quick installation for testing
The easiest way to test the Turtlet is to select the
Windows-standalone-version found here. Just unzip the package to some folder and you are set. Open this folder and select the Turtlet.exe to run program. This version includes packeted Python source with bundled Python interpreter and required modules in bytecode so no additional installations are neccessary.
This user interface test version omits the feature of creating own commands! You may use the Finnish command base described in the internal documents (Help->Commands) or limited English command base created for this English demonstration version (step, step N, left, right, square).
The latest Python version the Turtlet has been tested with was 2.6.2. If this version, or some of the required libraries is no longer available, use the newest 2.X-version, and their corresponding libraries.
First off, download the Python interpreter and modules (PIL, NumPy) and install them.
Then, download the source package for Turtlet, and extract the contents to any folder, for example "C:\Turtlet_Demo" does fine.
Now that we have the interpreter, all of the modules and source code available, we can run the Turtlet by running the file "ohjaus.pyc". Please notice that in some cases the interpreter is unable to setup the environment variables for the operating system and this starting method fails. In this case, open the file "ohjaus.py" in the bundled Python editor IDLE, and select "Run"->"Run program" or press F5 in editor window. If this file is unavailable, other option is to run the program from command parser, with command "[Python installatio folder]python [Turtlet installation folder]\ohjaus.pyc".
Please observe that you need Full installation for this tutorial to work.
Making own commands
In this tutorial we will implement a new command for the english command base called "around", which will tell the turtle figure to do a full 180-degree turn.
First of all, lets take a look around the source folder. The .py files work as follows:
kayttoliittyma.py creates and cotrols the graphical user interface.
visualisoija.py manages the movement of the turtle.
ohjaus.py initializes the Turtlet and oversees other modules.
LTYToiminta.py is the definition file for the standard command library.
omaToiminta.py is the definition file for the own commands.
Let's start the Turtlet and open the parser interface. Try giving the command "around". It should fail with error message "Command error: around". So we need to define the command in our personal command libary. Shut down the Turtlet and open the file omaToiminta.py in IDLE editor. You should now have the following window open:
First two lines import the other module libraries. The third line introduces the commands, which are implemented in the own commands. Rest of the file is compromised of the definitions for these commands. So, let's start the creation process for command "around".
First we add the command keyword to the list
ohjaus.omaT. Edit the third line to add the word in the list: ohjaus.omaT = ["square","step","right",
Now we have to create the command itself. First we have to
create a rule for the parseri-function, which receives the user-given command as a string value in variable "command". Before the
final else-clause, add line elif command == "around":, similarly as in commands right and left. Take notion of the
as in Python it is used to replace parenthesis characters in code division. With the level of indentation, the interpreter
divides the code to logical blocks, so be careful to use 4 space characters between the indentation levels. If you use the IDLE
editor, the right indentation level is allocated automatically to correspond current level. When you come to the end of a
code block, backspace in a empty row takes you back one indentation level.
Next we tell in our new elif-block what the Turtlet should
do. As we want it to turn around, we tell the visualization module visualisoija to turn the turtle twice to the left. This
can be achieved by calling the function visualisoija.vasemmalle() twice.
Last addition tells the module ohjaus that the command was
successfully completed. Let's add line return command to the end.
If all is done correctly, the file contents should now be something like this:
The red line starting with #-character is a comment line which introduces alternative implementation for turning twice to the left. Now you can start again the Turtlet. If everything is done correctly, the Turtlet starts without errors similarly as earlier. Now try to give command "around" in the parser window. If your turtle turns around, you have successfully implemented a new command in the Turtlet, and completed this tutorial.
Last update 15.11.2010.
Developer contact address
Jussi Kasurinen, DI
Lappeenrannan teknillinen yliopisto
Jussi Kasurinen, M.Sc.(tech)
Department of Information Technology
Lappeenranta University of Technology
Email: jussi (dot) kasurinen (at) lut (dot) fi
Department homepage: www.it.lut.fi
Lappeenranta University of Technology
P.O. Box 20
Office phone: (+358) (05) 621 2860
Reception hours: thursday 12-13