pimoroni / pimoroni-pico

Libraries and examples to support Pimoroni Pico add-ons in C++ and MicroPython.
https://shop.pimoroni.com/collections/pico
MIT License
1.32k stars 496 forks source link

Small addition to the GFX module reference #971

Closed vdveen closed 3 months ago

vdveen commented 4 months ago

Hi there! I just got my GFX Pack. Setup went quite neat, until I hit the problem that text wouldn't render on the GFX screen. It took me a lot of comparing-to-examples to figure out that I was missing a display.set_pen(15) statement in my first code for the GFX screen. It's nowhere on the GFX rendering page, and the way it's worded on the general PicoGraphics module page does not make clear that it was needed. Without the set_pen line, my screen just stays blank.

import picographics
import gfx_pack
board = gfx_pack.GfxPack()
board.set_backlight(0, 0, 255)  # Makes the Backlight Green

display = board.display

display.set_pen(15) #<--- IF I REMOVE THIS LINE MY SCREEN STAYS BLANK

# set up
#display.set_font("bitmap8")
display.text("Hello World!", 0, 0)
display.line(0, 0, 128, 64) 
display.update()  # Update display with the above items
helgibbons commented 3 months ago

Thanks! I've updated the code snippet in the GFX Pack readme to include the set_pen, hopefully this should help prevent other folks getting tripped up with this.