Personal tools
You are here: o studio 110 2016-17 tmp Inf 11 doku doku s py s upload surrealistische Wabe.py

surrealistische Wabe.py

Johannes Schenker > please update upload

surrealistische Wabe.py — Python Source, 1Kb

File contents

# Python für Kids - 4. Auflage

# Autor: Gregor Lingl
# Datum 10. 8. 2009
# wabe.py - Kapitel 2: Aufgabe 3 

from turtle import *


reset()

farben=("yellow","green", "cyan","orange","red","brown","blue","black",)

def a(n,m,o):
  penup()
  pendown()
  pensize(2)
  pencolor("white")
  fillcolor(farben[m])
  begin_fill()
  forward(10)
  left(60)
  forward(10)
  left(60)
  forward(10)
  left(60)
  forward(10)
  left(60)
  forward(10)
  left(60)
  forward(10)
  left(60)
  end_fill()
  for i in range(n):
    fillcolor(farben[o])
    pendown()

    begin_fill()
    forward(10)
    right(60)
    forward(10)
    right(60)
    forward(10)
    right(60)
    forward(10)
    right(60)
    forward(10)
    right(60)
    forward(10)
    right(60)
    end_fill()
    penup()
    forward(10)
    left(60)


def b(x):
    for i in range(x):
      n=i*6
      a(n)
      left(245)
      forward(25)

      
m=1
o=5 
for i in range(15):

  a(6,m,o)
  left(222)
  forward(100)
  if ((len(farben)-1)>m):
    m=m+1
  else:
    m=0
  if ((len(farben)-1)>o):
    o=o+1
  else:
    o=0


Document Actions