eurovision.py

Created by schraf

Created on December 23, 2023

937 Bytes


from kandinsky import fill_rect
from math import *
from turtle import *

fill_rect(0,0,320,222,(57,)*3)

def ptsCercle(n, ct, rayon):
 tab=[]
 for i in range(n):
   ngl=2*i*pi/n
   tab.append((ct[0]+rayon*cos(ngl),ct[1]+rayon*sin(ngl)))
 return tab
 
def demiDrte(A, B, k=6):
 C = (A[0]+(B[0]-A[0])*k,A[1]+(B[1]-A[1])*k)
 penup()
 goto(A)
 pendown()
 goto(C)

def go(x,y):
 penup()
 goto(x,y)
 pendown()  
 
def demi_ovale(d):
 r = d // 3  
 circle(r, 60 )
 circle(6 * r, 60 )
 circle(r, 60 )  

def ovale(d):
 demi_ovale(d)
 demi_ovale(d)
 
speed(0)
color((245,)*3)
for i in range(3):
  a = -30+30*i
  go(45*cos(radians(a)),45 * sin(radians(a)))
  setheading(a+90)
  ovale(40)

N = 12
DD = 36
O = (0,0)
tpts = ptsCercle(N, O, 80)
for j in range(N):
 pt = tpts[j]
 u = ptsCercle(DD, pt, 15)
 for i in range(DD//2 + 1):
   ind0 = (i + DD//4 + int(j*DD/N)) % DD
   ind1 = (ind0 + DD//2) % DD
   demiDrte(u[ind0],u[ind1])

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>.