Hello à toutes et tous,
Je travaille actuellement sur une Raspberry pi 4,
à laquelle j'ai installé un écran sur gpio ( gfx hat)
Après des nuits de recherches,
j'ai réussi à afficher du texte
Maintenant, j'aimerais afficher un petit logo.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32 #!/usr/bin/env python import time from gfxhat import lcd, backlight, fonts from PIL import Image, ImageFont, ImageDraw print("""Message de demarrage""") backlight.set_all(240,240,240) backlight.show() lcd.clear() width, height = lcd.dimensions() image = Image.new('P', (width, height)) draw = ImageDraw.Draw(image) text = "| SSid Wifi : Diagbox |\n|eth0=DHCP |\n| @ ip Wifi : http://diagbox |" font = ImageFont.truetype("/diagbox/ttf/OpenSans-Regular.ttf", 10) x = 00 y = 00 draw.text((x, y), text, 1, font) for x in range(50): for y in range(50): pixel = image.getpixel((x, y)) lcd.set_pixel(x, y, pixel) lcd.show()
J'ai essayé ce code :
Mais ça me renvoie cette erreur :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 #!/usr/bin/env python import time from gfxhat import lcd, backlight, fonts from PIL import Image, ImageFont, ImageDraw print("""Message de demarrage""") backlight.set_all(240,240,240) backlight.show() lcd.clear() width, height = lcd.dimensions() image = Image.open("/tmp/aa.jpg") x = 00 y = 00 for x in range(128): for y in range(64): pixel = image.getpixel((x, y)) lcd.set_pixel(x, y, pixel) lcd.show()
Voici le lien qui m'aide pour les modules de l'écran : http://docs.pimoroni.com/gfxhat/
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3 root@diagbox:/tmp# python test.py File "test.py", line 23 lcd.set_pixel(x, y, pixel)
Je débute en Python et j'essaie de trouver les infos sur le net, dans les forum
Mais la ça fait 1 semaine que je bloque.
Help me please
Merci par avance
Partager