Pico display github module reference

Hi there. I’ve brougth a pico display and since a few days i feel the micropython module “pico display” has disapear from the github repository. How can I get some clarification about the function reference to use ?

by clicking on the MicroPython function reference, we get this 404 error message:

The ‘pimoroni/pimoroni-pico’ repository doesn’t contain the ‘micropython/modules/pico_display’ path in ‘main’.

Everything is shifting to the new Pico Graphics and the new v1.19 uf2 image.

pimoroni-pico/README.md at main · pimoroni/pimoroni-pico (github.com)

Releases · pimoroni/pimoroni-pico (github.com)

thanks for the reply, it helps with the graphics, but what’s about using the RGB led and push buton ?

ok I’ve found the answers by reading the forum. Should be great having all the documentation in the README.md

ex of simple code using text, RGB led and push button:

import utime
from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY, PEN_RGB332
from pimoroni import Button
from pimoroni import RGBLED

print('test pico display')

button_a = Button(12)
button_b = Button(13)
button_x = Button(14)
button_y = Button(15)

led = RGBLED(6, 7, 8)


display = PicoGraphics(display=DISPLAY_PICO_DISPLAY, rotate=0, pen_type=PEN_RGB332 )

display.set_backlight(0.5)

display.set_pen(display.create_pen(255, 0, 0))       # Set a red pen
display.clear()                                      # Clear the display buffer
display.set_pen(display.create_pen(255, 255, 255))   # Set a white pen
display.text("pico display", 10, 10, 240, 6)  # Add some text
display.update()                              # Update the display with our changes

led.set_rgb(255, 0, 0)   # Set the RGB LED to red
utime.sleep(1)                   # Wait for a second
led.set_rgb(0, 255, 0)   # Set the RGB LED to green
utime.sleep(1)                   # Wait for a second
led.set_rgb(0, 0, 255)   # Set the RGB LED to blue

# waiting until button A is pressed
while button_a.read() == False:
    pass

led.set_rgb(0, 255, 0)  # Set the RGB LED to green

This is what I came up with for a test file for the new Pico Graphics…

import time
import picographics
from pimoroni_bus import SPIBus
from pimoroni import Button
from pimoroni import RGBLED

button_a = Button(12)
button_b = Button(13)
button_x = Button(14)
button_y = Button(15)

led = RGBLED(6, 7, 8)

from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY, PEN_P4
#from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY, PEN_P8
#from picographics import PicoGraphics, DISPLAY_PICO_DISPLAY, PEN_RGB332

display = PicoGraphics(display=DISPLAY_PICO_DISPLAY, rotate=270 ,pen_type=PEN_P4)
#display = PicoGraphics(display=DISPLAY_PICO_DISPLAY, rotate=270 ,pen_type=PEN_P8)
#display = PicoGraphics(display=DISPLAY_PICO_DISPLAY, rotate=270, pen_type=PEN_RGB332)

display.set_backlight(1.0)

black = display.create_pen(0, 0, 0)
red = display.create_pen(255, 0, 0)
yellow = display.create_pen(255, 255, 0)
green = display.create_pen(0, 255, 0)
blue = display.create_pen(0, 0, 255)

while True:
    if button_a.read(): 
        display.set_pen(red)
        display.clear()
        display.set_pen(black)
        #display.text("Button A Pressed", 10, 10, 240, 6)   # landscape
        display.text("Button A Pressed", 2, 10, 135, 3)    # potrait 
        display.update()
        led.set_rgb(255, 0, 0)
        time.sleep(1.0)
    elif button_b.read():
        display.set_pen(yellow)
        display.clear()
        display.set_pen(black)
        #display.text("Button B Pressed", 10, 10, 240, 6)   # landscape
        display.text("Button B Pressed", 2, 10, 135, 3)    # potrait 
        display.update()
        led.set_rgb(255, 255, 0)
        time.sleep(1.0)
    elif button_x.read():    
        display.set_pen(green)
        display.clear()
        display.set_pen(black)
        #display.text("Button X Pressed", 10, 10, 240, 6)   # landscape
        display.text("Button X Pressed", 2, 10, 135, 3)    # potrait 
        display.update()
        led.set_rgb(0, 255, 0)
        time.sleep(1.0)
    elif button_y.read():    
        display.set_pen(blue)
        display.clear()
        display.set_pen(black)
        #display.text("Button Y Pressed", 10, 10, 240, 6)   # landscape
        display.text("Button Y Pressed", 2, 10, 135, 3)    # potrait 
        display.update()
        led.set_rgb(0, 0, 255)
        time.sleep(1.0)        
        

The documentation and examples will catch up. Might take a little time, but I’m sure it will get done. That main readme should get most people going graphics wise.

I’m liking the changes.

Here is a demo of the text improvements for Explorer. Great work, Pimoroni crew!

# Demo of text upgrades for Explorer
# Tony Goodhew 24th June, 2022

import picographics
import utime

from picographics import PicoGraphics, DISPLAY_PICO_EXPLORER

display = PicoGraphics(display=DISPLAY_PICO_EXPLORER)

display.set_backlight(1.0)

white = display.create_pen(200, 200, 255)
black = display.create_pen(0, 0, 0)
red = display.create_pen(255, 0, 0)
blue = display.create_pen(0 ,0, 255)
yellow = display.create_pen(255, 255 ,0)
green = display.create_pen(0, 255,0)

display.set_pen(white)
display.text("Pico", 75, 20, 240, 4)
display.text("Explorer", 30, 45, 240, 4)
display.text("Display", 40, 70, 240, 4)
display.set_pen(yellow)
display.text("Default", 35, 100, 240, 4)
display.text("Font", 75, 125, 240, 4)
display.update()
utime.sleep(1)

display.set_pen(black)
display.clear()
display.set_pen(white)
display.set_font("bitmap8")
display.text("Hello World", 0, 0, scale=2)

display.set_font("bitmap6")
display.text("Hello World", 0, 15, scale=2)

display.set_font("bitmap14_outline")
display.text("Pimoroni", 0, 25, scale=2)

display.set_font("sans")
display.text("Pimoroni", 0, 65, scale=1)

display.set_font("gothic")
display.text("Pimoroni", 0, 90, scale=1)

display.set_font("cursive")
display.text("Pimoroni", 0, 115, scale=1)

display.set_pen(green)
display.set_font("serif")
display.text("Pimoroni", 0, 140, scale=1)

display.set_pen(red)
display.set_font("serif_italic")
display.text("Pimoroni", 0, 165, scale=1)

width = display.measure_text("Centred", scale=1)
x = int((240 - width)/2)
display.set_pen(blue)
display.text("Centred",x, 195, scale=1)

display.set_font("serif")
display.set_pen(yellow)
display.text("Angle 270 deg", 220, 230, 200, scale=0.9, angle = 270)
display.update()

I’m very glad lower case text is now easily available.
The suggested (255,255,255) for white is a bit too yellow so (200,200,255) look better on my Explorer.

My Tufty_2040 arrives today - should be fun.

1 Like

Nice, I haven’t played around with the fonts just yet. Do you need to set one to get the lower case?

Just the new ones moved from Badger.

I will be trying this out on my Display pack today.

Talking about colors. I’m partially color blind. I have a red green color deficiency. I can see red and green no problem, but telling yellow from green can be an issue for me. On the LCD displays anyway. I have to just trust that those with normal color vision see the difference. It has had me double check my code to be sure its displaying the color I want.

Woot, loving the font option and being able to have lower case text. Thanks Tony, I was completely oblivious to that. I have a Tufty 2040 on the way, going to have a lot of fun with that. =)

Pimoroni Pico Lipo on the back side.

1 Like

‘bitmap8’ has more symbols in it too - so you should be able to get it to do a degrees symbol :)

@hel
That I would like to know how to do! Bitmap8 is what I used above. I had a minimal amount of editing to do.

Just switched my Pi Pico based Weather Station code to bitmap8 font. Only had to edit my displayed text. temperature to Temperature etc. No positional changes or font size changes needed. =)

EDIT: Looks like the y in battery has the bottom clipped, may have to raise that up a tiny bit, lol.

EDIT: 2 Had to do a
display.set_font(“bitmap8”)
and
display2.set_font(“bitmap8”)