Skip to content

Instantly share code, notes, and snippets.

@PaulPolaschek
Created October 24, 2018 17:56
Show Gist options
  • Save PaulPolaschek/20bf2c50438b5ed0b57aa9eff80071d0 to your computer and use it in GitHub Desktop.
Save PaulPolaschek/20bf2c50438b5ed0b57aa9eff80071d0 to your computer and use it in GitHub Desktop.
import turtle
import random
def nadelbaum(c1="brown", c2stamm="brown",
c2nadeln="green", breite=20
hoehe=50):
turtle.color("brown","brown")
turtle.begin_fill()
turtle.forward(20)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.forward(20)
turtle.right(90)
turtle.forward(50)
turtle.right(90)
turtle.end_fill()
turtle.forward(20//2)
turtle.color("brown","green")
for x in range (3):
turtle.begin_fill()
turtle.forward(100//2)
turtle.left(120)
turtle.forward(100)
turtle.left(120)
turtle.forward(100)
turtle.left(120)
turtle.forward(50)
turtle.end_fill()
turtle.penup()
turtle.forward(-50)
turtle.left(60)
turtle.forward(100)
turtle.right(150)
turtle.forward(20)
turtle.left(90)
turtle.pendown()
def baum(c1="brown", c2stamm="brown",
c2blaetter="green", breite=20, hoehe=50,
radius=50):
turtle.color(c1,c2stamm)
turtle.begin_fill()
turtle.forward(breite)
turtle.right(90)
turtle.forward(hoehe)
turtle.right(90)
turtle.forward(breite)
turtle.right(90)
turtle.forward(hoehe)
turtle.right(90)
turtle.forward(breite//2)
turtle.end_fill()
turtle.color(c1,c2blaetter)
turtle.begin_fill()
turtle.circle(radius)
turtle.end_fill()
turtle.speed(0)
for b in range(1):
x = random.randint(-600,600)
y = random.randint(-400,400)
turtle.penup()
turtle.goto(x,y)
turtle.pendown()
h = random.randint(10,150)
b = random.randint(5,50)
r = random.randint(10,150)
nadelbaum()
turtle.exitonclick()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment