forked from htw-imi-info2/python-programming-exercises
/
haus.py
39 lines (29 loc) · 793 Bytes
/
haus.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# -----------------------------------------------------------------------
# Pythagoras Tree
# -----------------------------------------------------------------------
# python has a Turtle Graphics, see
# https://docs.python.org/3.10/library/turtle.html
# for available colors see https://www.tcl.tk/man/tcl8.4/TkCmd/colors.html
import sys
from turtle import *
def square(side_length):
forward(side_length)
left(90)
forward(side_length)
left(90)
forward(side_length)
left(90)
forward(side_length)
left(90)
def start_position(side_length):
up()
setposition((side_length / 2), -300)
left(90)
down()
def haus():
side_length = 300
start_position(side_length)
square(side_length)
done()
if __name__ == '__main__':
haus()