|
|
|
@ -27,7 +27,7 @@ def immeuble_aleatoire(numero:int) -> dict:
|
|
|
|
|
return informations |
|
|
|
|
|
|
|
|
|
def couleur_aleatoire() -> str: |
|
|
|
|
liste = ["red","blue","yellow","black","orange","purple","brown","pink","green"] |
|
|
|
|
liste = ["red","blue","yellow","black","orange","purple","brown","pink","green", "olive", "silver", "teal", "darkcyan", "aqua"] |
|
|
|
|
couleur = rd.randint(0,len(liste)-1) |
|
|
|
|
return liste[couleur] |
|
|
|
|
|
|
|
|
@ -41,6 +41,12 @@ def coordonees_fenetre(immeuble:dict) -> tuple:
|
|
|
|
|
x_gauche = x_gauche - 100 |
|
|
|
|
y_bas = y_bas + 20 |
|
|
|
|
return (x_gauche, y_bas) |
|
|
|
|
|
|
|
|
|
def coordonees_fenetre_etage(immeuble:dict) -> tuple: |
|
|
|
|
x_gauche, y_bas = coordonees_fenetre(immeuble) |
|
|
|
|
x_gauche = x_gauche + 45 |
|
|
|
|
return (x_gauche, y_bas) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def dessiner_facade(immeuble:dict) -> None: |
|
|
|
|
# Traduction des données de rue vers dessiner |
|
|
|
@ -68,11 +74,37 @@ def dessiner_fenetre(immeuble:dict) -> None:
|
|
|
|
|
cote = 30 |
|
|
|
|
ds.rectangle(cote, cote, crayon, (x,y)) |
|
|
|
|
|
|
|
|
|
def dessiner_fenetre_etage(immeuble:dict) -> None: |
|
|
|
|
crayon = {} |
|
|
|
|
crayon['écriture'] = 'white' |
|
|
|
|
crayon['fond'] = 'blue' |
|
|
|
|
crayon['épaisseur'] = 2 |
|
|
|
|
x, y = coordonees_fenetre_etage(immeuble) |
|
|
|
|
cote = 30 |
|
|
|
|
for i in range(2): |
|
|
|
|
ds.rectangle(cote, cote, crayon, (x + i * 45,y)) |
|
|
|
|
v = (x + i * 45,y) |
|
|
|
|
|
|
|
|
|
def dessiner_fenetre_immeuble(immeuble:dict) -> None: |
|
|
|
|
crayon = {} |
|
|
|
|
crayon['écriture'] = 'white' |
|
|
|
|
crayon['fond'] = 'blue' |
|
|
|
|
crayon['épaisseur'] = 2 |
|
|
|
|
x, y = coordonees_fenetre_etage(immeuble) |
|
|
|
|
cote = 30 |
|
|
|
|
for i in range(immeuble['etages']): |
|
|
|
|
x = -200 |
|
|
|
|
y = y + i * 80 |
|
|
|
|
for i in range(3): |
|
|
|
|
ds.rectangle(cote, cote, crayon, (x + i * 45,y)) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def dessiner_immeuble(immeuble:dict) -> None: |
|
|
|
|
dessiner_facade(immeuble) |
|
|
|
|
dessiner_porte(immeuble) |
|
|
|
|
dessiner_fenetre(immeuble) |
|
|
|
|
dessiner_fenetre_etage(immeuble) |
|
|
|
|
dessiner_fenetre_immeuble(immeuble) |
|
|
|
|
# à compléter avec d'autres fonctions pour le reste : toit, fenêtres... |
|
|
|
|
|
|
|
|
|
def dessiner_rue_aleatoire() -> None: |
|
|
|
@ -88,3 +120,4 @@ def dessiner_rue_decrite(rue:'?') -> None:
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__': |
|
|
|
|
dessiner_rue_aleatoire() |
|
|
|
|
|
|
|
|
|