Funkcja, pętle, wartości losowe.
import turtle
import random
t = turtle.Turtle()
t.speed(0) # 1:slowest, 3:slow, 5:normal, 10:fast, 0:fastest
def chmurka(r = 20):
t.setheading(250)
t.begin_fill()
for _ in range(2):
for _ in range(3):
t.circle(r, 180)
t.right(160)
for _ in range(2):
t.circle(r, 220)
t.right(160)
t.end_fill()
def przesun(x,y):
t.up()
t.goto(x,y)
t.down()
for x in range(-190,151,85):
for y in range(-135,136,90):
przesun(x,y)
if (0 == random.randint(0,2)):
t.fillcolor(145+random.randint(0,45),
190+random.randint(0,45),
205+random.randint(0,45))
chmurka(5+random.randint(0,5))
t.fillcolor("lightblue")
przesun(40,0)
chmurka()
przesun(-100,-170)
chmurka(23)
przesun(-140,140)
chmurka(18)