z_screen_size.py

Created by cent20

Created on March 30, 2023

1.01 KB

Place des rectangles au 4 coins de l’écran de la NumWorks, en exploitant les fonctions fill_rect et draw_string du module kandinsky de la calculatrice.


# https://nsi.xyz/ 

from kandinsky import fill_rect, draw_string 

# dessine un rectangle de 4 par 4 en (0,0) 
fill_rect(0, 0, 4, 4, "#42ff42")
draw_string("rectangle de 4x4 ", 5, 1, "#42ff42")
draw_string("coordonnées (0,0)", 5, 19, "#42ff42")

# dessine un rectangle de 1 par 1 en (319,0) 
fill_rect(319, 0, 1, 1, "#ff4242")
draw_string("  1x1 ", 230, 1, "#ff4242")
draw_string("(319,0)", 230, 19, "#ff4242")


# dessine un rectangle de 2 par 2 en (0,220) 
fill_rect(0, 220, 2, 2, "#4242ff")
draw_string("  2x2 ", 5, 180, "#4242ff")
draw_string("(0,220)", 5, 199, "#4242ff")


# dessine un rectangle de 1 par 1 en (319,0) 
fill_rect(319, 221, 1, 1, "#ff42ff")
draw_string("  1x1 ", 230, 180, "#ff42ff")
draw_string("(319,221)", 230, 199, "#ff42ff")

draw_string(" x  *  y utilisable", 42, 80, "#424242")
draw_string("320 * 222 utilisable", 42, 100, "#424242")
draw_string("de (0,0) à (319,221)", 42, 120, "#424242")

"""
Les couleurs peuvent (et devraient) être des tableaux,
soit des tuples, soit des listes
"""

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.