qrcode_v2.py

Created by laurent-cortot

Created on December 13, 2019

909 Bytes

Dessin d’un viseur de QRCode


from kandinsky import *

cote = int(input("Taille du carré ?"))
epaisseur = int(input("Epaisseur du coin ?"))

# Espace exploitable NumWorks : 320 x 220
xCarreRouge = (320 - cote) // 2
yCarreRouge = (220 - cote) // 2

# Définition coin à 3/8
coteCoin = (cote+2*epaisseur)*3//8

# Astuce Océane : carré bleu en coins
fill_rect(xCarreRouge-epaisseur, \
          yCarreRouge-epaisseur, \
          coteCoin, \
          coteCoin, \
          color(0,0,255))
fill_rect(xCarreRouge+cote+epaisseur-coteCoin, yCarreRouge-epaisseur, coteCoin, coteCoin, color(0,0,255))
fill_rect(xCarreRouge-epaisseur, yCarreRouge+cote+epaisseur-coteCoin, coteCoin, coteCoin, color(0,0,255))
fill_rect(xCarreRouge+cote+epaisseur-coteCoin, yCarreRouge+cote+epaisseur-coteCoin, coteCoin, coteCoin, color(0,0,255))

# Carré rouge en "sur-impression"
fill_rect(xCarreRouge, yCarreRouge, cote, cote, color(255,0,0))

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.