bewegen
Deutsch   English   

1. MOVE TURTLE

 

 

YOU LEARN HERE...

 

that a program consists of a sequence of program lines that are processed one after the other (as a sequence). You use a graphics window with a Turtle, which can be controlled with commands similar to a small robot.

Turtle commands always end with a pair of brackets called parameter brackets. This can contain further information for the command. Even if no information is required, an empty pair of brackets must be present in Python. As you already know, it is important to adhere exactly to upper/lower case.

The Turtle leaves a trail when it moves. It is as if it were carrying a drawing pen(s) resting on the drawing surface. This enables it to draw beautiful figures.

 

 

EXAMPLE

  Before the Turtle can get started, you must instruct the computer to provide the Turtle commands from a module. To do this, write
from gturtle import *

makeTurtle() creates a turtle. With WebTgerPython you can omit this line, as the turtle is created automatically.

With forward(100) the turtle moves forward by 100 steps, with left(90) it turns 90 degrees to the left and with right(90) dreht sie um 90 Grad nach rechts. it turns 90 degrees to the right. You can control the Turtle with these commands.

 

Program:    

from gturtle import *

makeTurtle()
forward(100)
left(90)
forward(50)
left(90)
forward(50)
right(90)
forward(50)
► Copy to clipboard

Click on the WebTigerPython or WebTigerJython button to insert the program into the editor. You can also open the empty online editor first and type in the program or copy it from the template. To do this, click on the Copy to clipboard link and paste the program using Paste (Ctrl-V, Ctrl-V)

 

 

REMEMBER...

 

You must make a difference between writing (editing) the program and executing it by clicking the Run button. Find out about the settings of the editor window under "Home/WebTigerPython".

 

 

TO SOLVE BY YOURSELF

 
1.

Use the command right(90) to tell the Turtle to turn 90° to the right.

Try to instruct the Turtle to draw an equilateral triangle with side length 100. Can you find the correct angle of rotation?


 


2.

The Turtle can also move backwards. For example, if you want it to move backwards 100 steps, use the command back(100):

from gturtle import *

makeTurtle()
forward(100)
back(100)

Draw the figure opposite

 

 

3.

With the dot(20) command, the Turtle draws a filled circle with a diameter of 20 where it is currently located.

from gturtle import *
makeTurtle()
forward(100)
dot(20)
Can you draw the figure opposite?

 

 

 

 



4.

Draw the adjacent figure. You can also abbreviate the commands with 2 letters:
fd(100), lt(90), rt(90).

 

     
1-1
Technical notes:

In TigerJython and WebTigerJython, a turtle must be created at the beginning of each program with the line makeTurtle(). It appears in the middle of the graphics window. If you forget this line, an error message appears.
In WebTigerPython is this line not required, but it is not an error if it is present.

In the following examples you can see the simpler version on the website, by clicking on the link “WebTigerJython” above the program, the program is inserted into the editor with makeTurtle() line.