panda.py

Created by arthurmichel-scolaire

Created on January 12, 2026

2.07 KB

noa n’a pas fait son dm donc il m’a demande de le faire pffff quelle nul


from kandinsky import *

def d(x,y,r,c):
  for i in range(-r,r+1):
    for j in range(-r,r+1):
      if i*i+j*j<=r*r:
        set_pixel(x+i,y+j,c)

def a(x,y,r,c):
  for i in range(-r,r+1):
    for j in range(-r,r+1):
      if r*r-4*r<i*i+j*j<=r*r:
        set_pixel(x+i,y+j,c)

# Couleurs
N=(0,0,0);B=(255,255,255)
R=(255,180,190);G=(220,220,220)
V=(80,180,80);V2=(60,140,60)
C=(135,206,250);J=(255,240,100)
C2=(255,255,255)

# Fond ciel degrade
for y in range(222):
  fill_rect(0,y,320,1,(135+y//4,206+y//8,250))

# Soleil
d(280,35,28,J)
d(280,35,22,(255,250,150))

# Nuages
for nx,ny in[(40,30),(90,45),(260,70)]:
  for ox in range(-15,20,12):
    d(nx+ox,ny,14,C2)

# Bambous fond
for bx in [20,45,275,300]:
  for by in range(10,222,18):
    d(bx,by,9,V)
    d(bx,by,9,V2) if by%36==10 else 0
  for ly in range(30,180,50):
    d(bx-12,ly,6,V);d(bx+12,ly-10,6,V)

# Sol herbe
for sx in range(5,320,8):
  d(sx,215,7,(100,180,100))

# === PANDA ===

# Corps blanc
d(160,175,45,B)

# Pattes arriere
d(120,200,20,N);d(200,200,20,N)

# Pattes avant
d(110,155,18,N);d(210,155,18,N)

# Coussinets roses
d(120,205,8,R);d(200,205,8,R)
d(115,208,4,R);d(125,208,4,R)
d(195,208,4,R);d(205,208,4,R)

# Tete principale
d(160,95,55,B)

# Oreilles externes noires
d(100,50,24,N);d(220,50,24,N)

# Oreilles internes roses
d(100,50,12,R);d(220,50,12,R)

# Taches yeux (forme panda)
d(125,88,24,N);d(195,88,24,N)
d(120,78,12,N);d(200,78,12,N)

# Yeux blancs
d(128,90,13,B);d(192,90,13,B)

# Iris brun
d(130,90,8,(60,40,20))

# Iris brun 2
d(190,90,8,(60,40,20))

# Pupilles
d(132,90,5,N);d(188,90,5,N)

# Reflets yeux
d(134,87,3,B);d(190,87,3,B)
d(129,92,2,(200,200,200))
d(191,92,2,(200,200,200))

# Sourcils
d(125,70,4,N);d(195,70,4,N)

# Museau ovale
d(160,115,20,G)
d(160,120,15,G)

# Nez coeur
d(160,108,9,N)
d(156,105,4,N);d(164,105,4,N)

# Reflet nez
d(158,105,2,(60,60,60))

# Bouche
d(160,125,3,N)
d(152,130,4,(180,100,100))
d(168,130,4,(180,100,100))

# Langue
d(160,133,5,R)

# Ventre
d(160,168,25,G)

# Bambou que tient le panda
d(240,140,7,V2)
d(240,160,7,V2)
d(240,180,7,V2)
d(248,135,5,V)
d(232,155,5,V)

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