#python mit graphics

from graphics import *

linealCanv = GraphWin('Ein Lineal', 1000, 50)

def strich(x, h):
l = Line(Point(x, 0), Point(x, h))
l.draw(linealCanv)

def lineal(l, r, h):
step = 5
if (h < 1):
return
m = (l + r) / 2
strich(m, h)
lineal(l, m, h - step)
lineal(m, r, h - step)

# Function Call
lineal(0, 1000, 50)

# Wait for a mouse click, then close (with error handling)
try:
linealCanv.getMouse()
linealCanv.close()
except:
pass # Window was already closed, that's fine