from myworld.TurtleWorld import TurtleWorld from myworld.World import wait_for_user from myworld.MyTurtle import MyTurtle # the following condition checks whether we are # running as a script, in which case run the test code, # or being imported, in which case don't. if __name__ == '__main__': world=TurtleWorld() bob=MyTurtle() bob.delay = 0.001 # draw a circle centered on the origin radius = 100 #bob.pu() bob.fd(radius) bob.lt() #bob.pd bob.square(radius) bob.circle(radius) bob.die() wait_for_user()
turty.lt(-90) turty.square(laenge*0.2) # ein zweites Fenster turty.move(laenge*0.6) turty.square(laenge*0.2) # wir gehen nun ins Freie turty.lt(-90) turty.move(laenge*0.4) turty.lt() turty.move(laenge) turty.lt(90) # Wir zeichnen einen Baum # Zuerst der Stamm turty.fd(baum) # nun einige Aeste turty.lt(80) for x in range(0,9): turty.fd(baum) turty.move(-baum) turty.lt(-20) # Der Stamm wird nun dicker turty.lt(-170) turty.fd(-3) turty.rectangle(6,baum) turty.die() wait_for_user()