# Using &kturtle;

Here is a screenshot of &kturtle; in action &kturtle; Main Window

The main window of &kturtle; has three main parts: the editor (1) on the left where you type the &turtlescript; commands, the the canvas (2) on the right where the turtle make your drawing, and the inspector (3) which gives you information when your program executes. Besides these you find the menu bar (5) from where all the actions can be reached, the toolbar (4) that allows you to quickly select the most used actions, the Console: input box, that you can use to enter a one line command to test it, and the statusbar (along the bottom of the window) where you will find feedback on the state of &kturtle;.

## The Editor

In the editor you type the &turtlescript; commands. Most of functions of the editor can be found in the File and Edit menus. The editor can be docked on each border of the main window or it can be detached and placed anywhere on your desktop.

You have several ways to get some code in the editor. The easiest way is to use an example: choose the File Examples submenu and select an example. The file example you choose will be opened in the the editor, you can then use the Run Run menu item (shortcut: &Alt;F2) or the Run button from the toolbar to run the code if you like.

You can open &turtlescript; files by choosing the File Open... menu item.

The third way is to directly type your own code in the editor or to copy/paste some code.

## The Canvas

The canvas is the domain of the turtle, here the turtle draws according to the commands it gets. After getting some code in the Editor and executing it, two things can happen: either the code executes fine, and will you most likely see something change on the canvas; or you have made an error in your code in that case the error tab will appear explaining you what mistake you made.

You can zoom in and out the canvas with your mouse wheel.

## The Inspector

The inspector informs you about the variables, the learned functions and show the code tree while the program is running.

The inspector can be docked on each border of the main window or it can be detached and placed anywhere on your desktop.

## The Toolbar

Here you can quickly reach the most used actions. The Toolbar also contains the Console: input box, where you can quickly invoke commands, this might be useful in case you want to test a command without modifying the content of the Editor.

You can configure the toolbar using Settings Configure Toolbars... to better fit your preferences.

## The Menubar

In the menubar you find all the actions of &kturtle;. They are in the following groups: File, Edit, Canvas, Run, Tools, Settings, and Help. This section describes them all.

### The File Menu

&Ctrl;N File New

- Creates a new, empty &turtlescript; file.

&Ctrl;O File Open...

- Opens a &turtlescript; file.

File Open Recent

- Opens a &turtlescript; file that has been opened recently.

File Examples

- Open example &turtlescript; programs. The examples are in your favorite language that you can choose in the Settings Script Language submenu.

File Get more examples...

- Open the Get Hot New Stuff dialog to download additional &turtlescript; files from the Internet.

&Ctrl;S File Save

- Saves the currently opened &turtlescript; file.

&Ctrl;&Shift;S File Save As...

- Saves the currently opened &turtlescript; file on a specified location.

File Export to HTML...

- Exports the current content of the Editor as an &HTML; file that includes highlighting colors.

&Ctrl;P File Print...

- Prints the current code in the editor.

&Ctrl;Q File Quit

- Quits &kturtle;.

### The Edit Menu

&Ctrl;Z Edit Undo

- Undoes the last change to code. &kturtle; has unlimited undos.

&Ctrl;&Shift;Z Edit Redo

- Redoes an undone change to the code.

&Ctrl;X Edit Cut

- Cuts the selected text from the editor to the clipboard.

&Ctrl;C Edit Copy

- Copies the selected text from the editor to the clipboard.

&Ctrl;V Edit Paste

- Pastes the text from the clipboard to the editor.

&Ctrl;A Edit Select All

- Selects all the text from the editor.

&Ctrl;F Edit Find...

- With this action you can find phrases in the code.

F3 Edit Find Next

- Use this to find the next occurrence of the phrase you searched for.

&Shift;F3 Edit Find Previous

- Use this to find the previous occurrence of the phrase you searched for.

&Ins; Edit Overwrite Mode

- Toggle between the 'insert' and 'overwrite' mode.

### The Canvas Menu

Canvas Export to Image (PNG)...

- Exports the current content of the Canvas as a raster image of the PNG (Portable Network Graphics) type.

Canvas Export to Drawing (SVG)...

- Exports the current content of the Canvas as a vector drawing of the &SVG; (Scalable Vector Graphics) type.

Canvas Print Canvas...

- Prints the current content of the Canvas.

### The Run Menu

F5 Run Run

- Starts the execution of the commands in the editor.

F6 Run Pause

- Pauses the execution. This action is only enabled when the commands are actually executing.

F7 Run Abort

- Stops the execution. This action is only enabled when the commands are actually executing.

Run Run Speed

- Present a list of possible execution speeds, consisting of: Full Speed (no highlighting and inspector), Full Speed, Slow, Slower, Slowest and Step-by-Step. When the execution speed is set to Full Speed (default) we can barely keep up with what is happening. Sometimes this behavior is wanted, but sometimes we want to keep track of the execution. In the latter case you want to set the execution speed to Slow, Slower or Slowest. When one of the slow modes is selected the current position of the executor will be shown in the editor. Step-by-Step will execute one command at a time.

### The Tools Menu

Tools Direction Chooser...

- This action opens the direction chooser dialog.

Tools Color Picker...

- This action opens the color picker dialog.

### The Settings Menu

Settings Script Language

- Choose the language for the code.

&Ctrl;E Settings Show Editor

- Show or hide the Editor.

&Ctrl;I Settings Show Inspector

- Show or hide the inspector.

Settings Show Errors

- Show or hide the Errors tab with a list of errors resulting from running the code. If this option is enabled, click on Canvas to see the turtle again.

F11 Settings Show Line Numbers

- With this action you can show the line numbers in the editor. This can be handy for finding errors.

Settings Show Toolbar

- Toggle the Main Toolbar.

Settings Show Statusbar

- Toggle the Statusbar.

Settings Configure Shortcuts...

- Standard &kde; dialog to configure the shortcuts.

Settings Configure Toolbars...

- The standard &kde; dialog for configuring the toolbars.

### The Help Menu

&kturtle; has a default &kde; Help menu as described in the &kde; Fundamentals with one additional entry:

F2 Help Help on: ...

- This is a very useful function: it provides help on the code where the cursor in the editor is at. So, ⪚, you have used the `print` command in your code, and you want to read and to know what the handbook says on this command. You just move your cursor so it is in the `print` command and you press F2. The handbook will then show all info on the `print` command.

  This function can prove to be useful while learning &turtlescript;.

## The Statusbar

On the status bar you get feedback of the state of &kturtle;. On the left side it shows the feedback on the last action. On the right side you find the current location of the cursor (line and column numbers). In the middle of the status bar is indicated the current language used for the commands.