I've made a pygame GUI interface with buttons who are activated when the user click on them. The GUI works well when i'm using my real mouse but when I run the GUI on the PITFT (https://www.adafruit.com/product/1601 ), buttons do not respond to clicks ( even if i use a harder material than my finger like a stylus ).
So the question is : Are Pygame click event compatible with the PITFT or are there a kind of "special" event made for it ?
Here is the current mouse event i use in my code :
def run(self):
"""Lance la boucle principale pour gérer les événements
"""
while True:
event = pygame.event.wait()
if event.type == MOUSEBUTTONDOWN and event.button == 1 and not self.keep_level_2:
self.click(event.pos)
elif event.type == MOUSEBUTTONUP and event.button == 1:
self.release(event.pos)`
I shearch on the internet and found that in order to use the PiTft, you need to add the following lines :
os.environ['SDL_VIDEODRIVER'] = 'fbcon'
os.environ["SDL_FBDEV"] = "/dev/fb1"
os.environ["SDL_MOUSEDEV"] = "/dev/input/touchscreen"
os.environ["SDL_MOUSEDRV"] = "TSLIB"
So i've tried adding them but the touchscreen is still not responding.
Also, when to program run, i can't quit it ( CTRL C and escape don't work ).
Note : My code is not running in python 3