e04.py

Created by ilyas-r

Created on August 07, 2023

361 Bytes

Représentation d’un soleil rayonnant en Python. Développé par Ilyas R. à l’occasion du DM E04.0 “Le Python et la Tortue” édition 2022-2023. #nsi_xyz


from turtle import goto,hideturtle,pos,pencolor,forward,right
from kandinsky import fill_rect
fill_rect(0,0,320,222,"black")
a,b,d=0,0,55
goto(0,d)
hideturtle()
while a != 210:
    for i in range(a):
        d = (abs(pos()[0])**2+abs(pos()[1])**2)**0.5
        pencolor(255,round(((d+30)/140)*255),0)
        forward(1)
    right(b)
    a,b = a+1,b+1