Flipping GFX HAT display 180 degrees

Hi,
I have the GFX HAT and I’m displaying text on it. Unfortunately, due to the configuration of the charging cable for my Pi 4 I would prefer the text to be displayed upside down. I’m trying to modify the default hello_world.py script, I’ve tried the following, but the LCD is blank:
draw = ImageDraw.Draw(image.rotate(180))
I’d greatly appreciate help, and apologise for such a nooby question.

I’ve not got one handy to test, but it looks like 180 degree rotation is supported in the GFX Hat library:

from gfxhat import lcd

lcd.rotation(r=180)
1 Like

Thanks for the reply. Unfortunately when I try that I get this error:

AttributeError: module 'gfxhat.lcd' has no attribute 'rotation'
``` even though I have imported lcd?

Ah okay, so the gfx hat library installed isn’t the same as that on github: I’ve updated it and get no erorr, yet the display remains unflipped

Never mind, just had to reimport the latest version of the repo. Cheers!

1 Like