예제 #1
0
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()
    

예제 #2
0
파일: markus.py 프로젝트: peterfuchs1/Bruch
# or being imported, in which case don't.

if __name__ == '__main__':
    world=TurtleWorld()
# Wir erzeugen einen Turtle
    turty=MyTurtle()
# Der Turtle wartet auf uns
    turty.delay = 0.4

# Die Laenge betraegt 100 Punkte
    laenge = 100
    baum=laenge/2
# Wir drehen turty um 90
    turty.lt(90)
# Wir zeichen ein Quadrat
    turty.square(laenge)
# Wir gehen auf das Quadrat hinauf    
    turty.move(laenge)
# Der linke Giebel    
    turty.lt(45)
    turty.fd(laenge/2*math.sqrt(2))
# und nun der rechte Giebel    
    turty.lt(90)
    turty.fd(laenge/2*math.sqrt(2))    
# Haus ist fertig
#    turty.die()
    turty.lt(45)
    turty.move(laenge)
    turty.lt(90)
# Bitte eine Ture    
    turty.move(laenge*0.4)