import math from gpanel import * class Myturtle: def __init__(self): # Position: self.x=0 self.y=0 # Winkel self.a = 0 # Schrittweite self.l = 10 move(self.x, self.y) def forward(self, draw=True): self.x += self.l * math.cos(self.a) self.y += self.l * math.sin(self.a) if draw: lineTo(self.x, self.y) else: move(self.x, self.y) def turn(self,a): self.a+=a/180.0*math.pi if __name__=="__main__": makeGPanel(-20, 20, -20, 20) t = Myturtle() for i in range(5): t.forward() t.turn(72)