# Rotate with button

**URL:** https://forums.pimoroni.com/t/rotate-with-button/26388
**Category:** Discussion
**Created:** [October 22, 2024, 7:27am UTC](https://forums.pimoroni.com/t/rotate-with-button/26388 "2024-10-22T07:27:00Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![SamDeene](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@SamDeene](https://forums.pimoroni.com/u/SamDeene)
#### Post date: [October 22, 2024, 7:27am UTC](https://forums.pimoroni.com/t/rotate-with-button/26388/1 "2024-10-22T07:27:00Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)
#### Post date: [October 22, 2024, 8:36am UTC](https://forums.pimoroni.com/t/rotate-with-button/26388/2 "2024-10-22T08:36:07Z")

</div>

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.

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

```

---

<div class="post-metadata">

### Author: ![SamDeene](https://avatars.discourse-cdn.com/v4/letter/s/7bcc69/32.png) [@SamDeene](https://forums.pimoroni.com/u/SamDeene)
#### Post date: [October 22, 2024, 9:52am UTC](https://forums.pimoroni.com/t/rotate-with-button/26388/3 "2024-10-22T09:52:50Z")

</div>

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

---

<div class="post-metadata">

### Author: ![alphanumeric](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.pimoroni.com/alphanumeric/32/2729_2.png) [@alphanumeric](https://forums.pimoroni.com/u/alphanumeric)
#### Post date: [October 22, 2024, 5:00pm UTC](https://forums.pimoroni.com/t/rotate-with-button/26388/4 "2024-10-22T17:00:08Z")

</div>

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