Rotate with button

Apologies if this is simple, can’t for the life of me figure it out.

I am using PicoGraphics with a Pimoroni Pico Display Pack 2.0 and know I can set rotation when setting the display, for example:
display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2, pen_type=PEN_P4, rotate=180)

However I cannot for the life of me find a way to rotate the screen with one of the 4 buttons I have available. I have tried assigning one of the buttons to the same line above hoping it will re-initialise the display with the new rotation specified but it does not work (nor did I expect it to):
if button_x.read():
display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2, pen_type=PEN_P4, rotate=90)

Is there an obvious function I’m missing that will accomplish this?

Are refreshing redrawing the display after doing the rotate command. You will have to update the display buffer and retransfer it to the display for things to change.

display = PicoGraphics(display=DISPLAY_PICO_DISPLAY_2, pen_type=PEN_P4, rotate=90)
display.clear()
display.text etc
display.update() 
1 Like

Ah brilliant I get it now thank you! Exactly what I needed, I can now rotate with the button thanks :)

1 Like

I was hoping you would say that. Have fun. =)