cours-snt/photo numérique/dm_turtle/tests.py
2022-10-25 14:26:36 +02:00

38 lines
617 B
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import turtle as t
# 30 12
# 36 5
# 20 9
# 35 cest joli
# 21 ça va loin
def etoile(nb):
l = 200
while True:
t.forward(l)
t.left(360/nb+180)
l *= 1.05
def spirale():
angle = 5
nb_tours = 0
while True:
nb_tours += 1
t.forward(1)
t.left(angle)
angle -= 0.5/nb_tours
def polygon(l, nb):
for i in range(nb):
t.forward(l)
t.left(360/nb)
def rotating_shape(shape_function, a):
while True:
shape_function()
t.left(a)
if __name__ == '__main__':
rotating_shape(lambda:polygon(50,4), 20)
input()