Can my state machine change screens in each state?

Alright, I’m about to rip my hair out. I’m working to make a simple application on my Raspberry Pi that changes screens with each change in state (I’m using a state machine). Is doing this even possible?

For example: User sees starting screen, pushes button which places them in state machine. Each state in the state machine has an exit, such as “button pushed,” or “input received from Raspberry pi”, and then it goes to a new state with a new screen.

Attached is my code.

mycode.docx (17.8 KB)