smalltalk.py

Created by schraf

Created on May 04, 2024

593 Bytes

Adaptation en Python Turtle d’un script écrit à l’origine en Smalltalk (Revue Micro Systèmes de février 1984 - pages 116 et suivantes)


import turtle
from kandinsky import fill_rect

t = turtle
t.speed(0)
t.hideturtle()

def napperon(nb_spirales, alea):
    t.color(220, 60, 110)
    increment = 0
    for _ in range(nb_spirales):
        t.penup()
        t.goto(0, 0)
        t.pendown()
        t.setheading(increment)
        increment += 360 / nb_spirales
        t.fd(60)
        t.left(90)
        tracer_spirale(alea)

def tracer_spirale(a):
    nombre = 0
    for _ in range(71):
        t.fd(nombre)
        t.right(a)
        nombre += 1.5

fill_rect(0, 0, 320, 222, (255, 255, 185))
napperon(7, 124)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our <a href="https://www.numworks.com/legal/cookies-policy/">cookies policy</a>.