X-mas Special

  • MUSTERBEISPIEL: Fadengrafik
import turtle

# usage:    t: turtle, 
#           px: x-coordinate of starting point, 
#           py: y-coordinate of starting point,
#           qx: x-coordinate of end point, 
#           qy: y-coordinate of end point,       
def line(t, px, py, qx, qy):
    t.penup()
    t.goto(px,py)
    t.pendown()
    t.goto(qx,qy)

t = turtle.Turtle()
t.hideturtle()

line(t, 0, 250, 300, 250)
line(t, 0, 260, 300, 260)
line(t, 0, 270, 300, 270)
line(t, 0, 280, 300, 280)

for i in range(4):
    line(t, 300 + 10 * i, 0, 300 + 10 * i, 200)

for i in range(11):
    line(t, i*20, 0, 200, i*20)