dynaspiralen
Dynaspiralen
- dynaspiralen.py
from turtle import Turtle, Screen
class MyTurtle(Turtle):
def jump(self, laenge):
self.penup()
self.forward(laenge)
self.pendown()
def polyschritt(self, laenge, winkel):
self.forward(laenge)
self.left(winkel)
screen = Screen()
alex = MyTurtle()
bert = MyTurtle()
bert.left(90)
bert.color("red")
carl = MyTurtle()
carl.color("green")
carl.left(180)
dinu = MyTurtle()
dinu.left(270)
dinu.color("blue")
kroeten = (alex, bert, carl, dinu)
for krot in kroeten:
krot.hideturtle()
krot.speed(0)
krot.jump(50)
krot.pensize(3)
krot.right(30)
for laenge in range(100, 0, -5):
screen.tracer(False)
for krot in kroeten:
krot.polyschritt(laenge, 120)
screen.tracer(True)
input()
dynaspiralen.txt · Zuletzt geändert: 2015/04/26 16:06 von admin