Python Forum
python script for gfx hat (LCD for raspberry)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
python script for gfx hat (LCD for raspberry)
#10
(Jul-04-2019, 02:09 AM)noisefloor Wrote: Hi, it doesn't work because you ignored what I wrote about and / or don't understand the code you posted in the initial post. Again: you have to iterate over the image and need to set _each_ pixel of your LCD, one-by-one. That's what the lines 59-62 do in the code of your 1st post. The Python module for display seems to have no high-level interface, you have to deal low level which each pixel. Regards, noisefloor

Hy
thank you to answer.

I don't ignore what you wrote.
Ii don't understand the whole code in the initial post.

I try to find informations about to better understand.

I try to modify considering what you have wrote

#!/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")
draw = ImageDraw.Draw(image)

for x in range(50):
    for y in range(50):
        pixel = image.getpixel((x, y))
        lcd.set_pixel(x, y, pixel)

lcd.show()
The error whicvh i have when i execut the scripts :


root@diagbox:/tmp# python test.py
Message de demarrage
Traceback (most recent call last):
File "test.py", line 21, in <module>
lcd.set_pixel(x, y, pixel)
File "/usr/local/lib/python2.7/dist-packages/gfxhat/st7567.py", line 137, in set_pixel
self.buf[offset] |= (value & 1) << bit
TypeError: unsupported operand type(s) for &: 'tuple' and 'int'
Reply


Messages In This Thread
RE: python script for gfx hat (LCD for raspberry) - by domoticity - Jul-04-2019, 09:47 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Re-write BASH script to Python script popi75 5 2,605 Apr-30-2021, 03:52 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020