Modifications

Sauter à la navigation Sauter à la recherche
104 octets ajoutés ,  9 février 2018 à 12:22
Ligne 192 : Ligne 192 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
{{traduction}}
   
La portion de code ci-dessus, initialise la bibliothèque d'affichage avec {{fname|begin()}} et efface le contenu avec {{fname|clear()}} et {{fname|display()}} .
 
La portion de code ci-dessus, initialise la bibliothèque d'affichage avec {{fname|begin()}} et efface le contenu avec {{fname|clear()}} et {{fname|display()}} .
   Ligne 208 : Ligne 207 :  
</syntaxhighlight>
 
</syntaxhighlight>
   −
Une fois l'afficheur initialisé et un objet dessin (ImageDrawing) préparé, vous pouvez dessiner des formes, du texte et des graphiques en utilisant [http://effbot.org/imagingbook/imagedraw.htm des commandes de dessin PIL]. Here we are loading the <code>default</code> font, which works fine, but there's other fonts you can load.
+
Une fois l'afficheur initialisé et un objet dessin (ImageDrawing) préparé, vous pouvez dessiner des formes, du texte et des graphiques en utilisant [http://effbot.org/imagingbook/imagedraw.htm des commandes de dessin PIL] (''effbot.org, anglais''). Dans le cas présent, le code charge la font {{fname|par défaut}} qui est parfaite mais vous pouvez également charger d'autres fonts. Il es possible de charger des fonts TrueType et de les utiliser pour faire du rendu de texte de tout style
   −
Next the code loads a built-in default font and draws a few lines of text. You can also load your own TrueType font and use it to render fancy text in any style you like
+
Une fois la font par défaut chargée, il est possible d'afficher quelques lignes de texte.  
    
<syntaxhighlight lang="python">
 
<syntaxhighlight lang="python">
 
while True:
 
while True:
   −
     # Draw a black filled box to clear the image.
+
     # Afficher un rectangle noir pour effacer l'image de l'écran.
 
     draw.rectangle((0,0,width,height), outline=0, fill=0)
 
     draw.rectangle((0,0,width,height), outline=0, fill=0)
   −
     # Shell scripts for system monitoring from here : https://unix.stackexchange.com/questions/119126/command-to-display-memory-usage-disk-usage-and-cpu-load
+
     # Script shell pour surveiller les paramètres système :  
 +
    # https://unix.stackexchange.com/questions/119126/command-to-display-memory-usage-disk-usage-and-cpu-load
 
     cmd = "hostname -I | cut -d\' \' -f1"
 
     cmd = "hostname -I | cut -d\' \' -f1"
 
     IP = subprocess.check_output(cmd, shell = True )
 
     IP = subprocess.check_output(cmd, shell = True )
Ligne 228 : Ligne 228 :  
     Disk = subprocess.check_output(cmd, shell = True )
 
     Disk = subprocess.check_output(cmd, shell = True )
   −
     # Write two lines of text.
+
     # Ecrire deux lignes de texte
 
   
     draw.text((x, top),      "IP: " + str(IP),  font=font, fill=255)
 
     draw.text((x, top),      "IP: " + str(IP),  font=font, fill=255)
 
     draw.text((x, top+8),    str(CPU), font=font, fill=255)
 
     draw.text((x, top+8),    str(CPU), font=font, fill=255)
29 917

modifications

Menu de navigation