How do you access the pHAT Stack's GPIO?

Hello! I am looking into buying a pHAT Stack for one of my projects.

In this forum post, i figured out that it works with any GPIO attachment:

Now I want to how how I can access those GPIO ports in Python code. For example, without the pHAT Stack, you can get input from a button with:

import RPi.GPIO as GPIO # Import Raspberry Pi GPIO library

GPIO.setwarnings(False) # Ignore warning for now
GPIO.setmode(GPIO.BOARD) # Use physical pin numbering
GPIO.setup(10, GPIO.IN, pull_up_down=GPIO.PUD_DOWN) # Set pin 10 to be an input pin and set initial value to be pulled low (off)

while True: # Run forever
    if GPIO.input(10) == GPIO.HIGH:
        print("Button was pushed!")

How can this be done if this button was connected to pin 10 of one of the 40 pins on the pHAT Stack?

Any help is appreciated, Thanks!

The pHAT stack duplicates the GPIO header so that more devices can be attached, but it doesn’t create more pins. So, if you want to turn GPIO 10 on then you use the exact same code, and all of the corresponding pins on the different headers go high. The pHAT stack doesn’t create more GPIO pins which you can control individually, all of the headers are direct copies of the GPIO pins on the Raspberry Pi.