This is an easy example in Python, how you can use the PiTFT with the buttons.
See the Python Program Example -> "test_1.py"
Pi Image from:
https://learn.adafruit.com/adafruit-2-2-pitft-hat-320-240-primary-display-for-raspberry-pi/detailed-installation?view=all#easy-install