Page 1 of 1

Joyeux 14 Juillet 2020 illustré en Python sur NumWorks

Unread postPosted: 14 Jul 2020, 10:24
by Admin
12653En ce jour de fête nationale, NumWorks met à profit les formidables possibilités Python de sa calculatrice pour t'animer ses bons vœux.

Et puis n'hésite pas à aller consulter la publication officielle, NumWorks te propose en effet de gagner un assortiment de formages La Box Fromage pour fêter l'occasion. ;)

Code: Select all
from kandinsky import *
from time import *

white=color(255,255,255)

def draw_iron():
  rects = [
  (37,24,2,197,(130,130,130)),
  (29,25,1,195,(115,115,115)),
  (39,24,1,197,(106,106,106)),
  (38,23,1,1,(115,115,115)),
  (37,22,1,1,(115,115,115)),
  (29,24,1,1,(115,115,115)),
  (30,23,1,1,(115,115,115)),
  (31,22,6,1,(115,115,115)),
  (33,23,4,198,(167,167,167)),
  (30,24,2,197,(167,167,167)),
  (37,23,1,1,(142,142,142)),
  (31,23,1,1,(142,142,142)),
  (32,23,1,198,(218,218,218)),
  ]
  for r in rects:
    fill_rect(*r)
def draw_flag():
  rects = [
  (40,49,84,125,(0,50,160)),
  (201,49,77,125,(200,25,10)),
  ]
  for r in rects:
      fill_rect(*r)

def erase():
  fill_rect(40,19,247,31,white)
  fill_rect(40,174,247,31,white)

def draw_flag1():
  rects = [
  (40,35,7,144,(0,49,156)),
  (47,34,7,144,(0,49,156)),
  (54,33,7,144,(0,49,156)),
  (61,32,7,144,(0,49,156)),
  (68,31,7,144,(0,49,156)),
  (75,30,7,144,(0,49,156)),
  (82,30,7,144,(0,49,156)),
  (89,30,7,144,(0,49,156)),
  (96,31,7,144,(0,49,156)),
  (103,31,7,144,(0,49,156)),
  (110,32,7,144,(0,49,156)),
  (117,33,7,144,(0,49,156)),
  (201,46,7,144,(198,24,8)),
  (208,47,7,144,(198,24,8)),
  (215,48,7,144,(198,24,8)),
  (222,48,7,144,(198,24,8)),
  (229,49,7,144,(198,24,8)),
  (236,49,7,144,(198,24,8)),
  (243,49,7,144,(198,24,8)),
  (250,48,7,144,(198,24,8)),
  (257,48,7,144,(198,24,8)),
  (264,47,7,144,(198,24,8)),
  (271,47,7,144,(198,24,8)),
  ]
  for r in rects:
      fill_rect(*r)

def draw_flag2():
  rects = [
  (117,33,7,144,(0,49,156)),
  (110,34,7,144,(0,49,156)),
  (103,35,7,144,(0,49,156)),
  (96,36,7,144,(0,49,156)),
  (89,37,7,144,(0,49,156)),
  (82,38,7,144,(0,49,156)),
  (75,40,7,144,(0,49,156)),
  (68,41,7,144,(0,49,156)),
  (61,42,7,144,(0,49,156)),
  (54,42,7,144,(0,49,156)),
  (47,42,7,144,(0,49,156)),
  (40,41,7,144,(0,49,156)),
  (201,36,7,144,(198,24,8)),
  (208,38,7,144,(198,24,8)),
  (215,40,7,144,(198,24,8)),
  (222,41,7,144,(198,24,8)),
  (229,43,7,144,(198,24,8)),
  (236,44,7,144,(198,24,8)),
  (243,45,7,144,(198,24,8)),
  (250,46,7,144,(198,24,8)),
  (257,48,7,144,(198,24,8)),
  (264,49,7,144,(198,24,8)),
  (271,49,7,144,(198,24,8)),
  ]
  for r in rects:
      fill_rect(*r)

def draw_flag3():
  rects = [
  (40,44,7,144,(0,49,156)),
  (47,45,7,144,(0,49,156)),
  (54,46,7,144,(0,49,156)),
  (61,47,7,144,(0,49,156)),
  (68,48,7,144,(0,49,156)),
  (75,49,7,144,(0,49,156)),
  (82,49,7,144,(0,49,156)),
  (89,49,7,144,(0,49,156)),
  (96,48,7,144,(0,49,156)),
  (103,48,7,144,(0,49,156)),
  (110,47,7,144,(0,49,156)),
  (117,46,7,144,(0,49,156)),
  (201,33,7,144,(198,24,8)),
  (208,32,7,144,(198,24,8)),
  (215,31,7,144,(198,24,8)),
  (222,31,7,144,(198,24,8)),
  (229,30,7,144,(198,24,8)),
  (236,30,7,144,(198,24,8)),
  (243,30,7,144,(198,24,8)),
  (250,31,7,144,(198,24,8)),
  (257,31,7,144,(198,24,8)),
  (264,32,7,144,(198,24,8)),
  (271,32,7,144,(198,24,8)),
  ]
  for r in rects:
    fill_rect(*r)

def draw_flag4() :
  rects = [
  (117,46,7,144,(0,49,156)),
  (110,45,7,144,(0,49,156)),
  (103,44,7,144,(0,49,156)),
  (96,43,7,144,(0,49,156)),
  (89,42,7,144,(0,49,156)),
  (82,41,7,144,(0,49,156)),
  (75,39,7,144,(0,49,156)),
  (68,38,7,144,(0,49,156)),
  (61,37,7,144,(0,49,156)),
  (54,37,7,144,(0,49,156)),
  (47,37,7,144,(0,49,156)),
  (40,38,7,144,(0,49,156)),
  (201,43,7,144,(198,24,8)),
  (208,41,7,144,(198,24,8)),
  (215,39,7,144,(198,24,8)),
  (222,38,7,144,(198,24,8)),
  (229,36,7,144,(198,24,8)),
  (236,35,7,144,(198,24,8)),
  (243,34,7,144,(198,24,8)),
  (250,33,7,144,(198,24,8)),
  (257,31,7,144,(198,24,8)),
  (264,30,7,144,(198,24,8)),
  (271,30,7,144,(198,24,8)),
  ]
  for r in rects:
    fill_rect(*r)
t=0.7
def draw():
  draw_flag1()
  sleep(t)
  erase()
  draw_flag2()
  sleep(t)
  erase()
  draw_flag3()
  sleep(t)
  erase()
  draw_flag4()
  sleep(t)
  erase()

draw_iron()
while (True):
  draw()


Installation : https://workshop.numworks.com/python/nu ... _nationale
Source : https://twitter.com/NumWorksFR/status/1 ... 5215123456

Re: Joyeux 14 Juillet 2020 illustré en Python sur NumWorks

Unread postPosted: 14 Jul 2020, 11:09
by cent20
TI nous propose t'il de gagner du pâté ? :D

Re: Joyeux 14 Juillet 2020 illustré en Python sur NumWorks

Unread postPosted: 17 Jul 2020, 22:14
by critor
Résultat du concours :