Micro Python code for Display Pack 2.0

Hello,
I’ve got a Pico and I’ve added the Display Pack 2.0. I’ve found the code to make bouncing balls and can get that to run nicely. Now… all I want to be able to do is display some text on the display. I’ve worked my way through all that I can find, created some code and it does very little. Please can you advise me where I’m going wrong, or can you suggest the code I need?

import time
from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY_2
display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2)

from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY_2, PEN_P8

display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2, pen_type=PEN_P8)
display.set_backlight(1)

Set the required rotation

display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2, rotate=0)

Set the backlighting level

display.set_backlight(1)

Set the font

display.set_font(“sans”)

Set the thickness of the font lines in pixels

display.set_thickness(4)

display.text(“Hello World”, 100, 100, wordwrap=200, scale=4)

display.circle(100, 100, 50)

time.sleep(5)

display.set_font(“bitmap8”)

display.character(38, 0, 0, scale=2)

Just FYI, if you have three backticks (`) before and after your code then it formats it to be more easily read:

import time
from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY_2
display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2)

from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY_2, PEN_P8

display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2, pen_type=PEN_P8)
display.set_backlight(1)
Set the required rotation
display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2, rotate=0)
Set the backlighting level

display.set_backlight(1)
Set the font

display.set_font(“sans”)
Set the thickness of the font lines in pixels
display.set_thickness(4)

display.text(“Hello World”, 100, 100, wordwrap=200, scale=4)
display.circle(100, 100, 50)

time.sleep(5)
display.set_font(“bitmap8”)
display.character(38, 0, 0, scale=2)

I don’t know PicoGraphics especially well, but it looks like you’re missing a call to the display.update() function.

1 Like

Ditto to that. You need at least one to display anything.