- 
FT5406: for the official 7" touchscreen display (pure Python by Pimoroni).
 - 
EP0510M09: for the 4DSystems GEN4-4DPI-50CT-CLB, https://4dsystems.com.au/gen4-4dpi-50ct-clb (by IstvanZK)
 
Uses python3-evdev, https://python-evdev.readthedocs.io/en/latest/index.html
Uses asyncio to read and store the touchscreen events returned from evdev
This is a work in progress, but lets you use all 10 points of multitouch on the official 7" Pi Touchscreen in Python.
Note: It will only work with any sort of sanity in fullscreen mode currently
Hit ESC to exit the examples.
Navigate into the library folder, and run setup like so:
cd library
sudo python3 setup.py installSee the examples folder for usage!
import ft5406
ts = ft5406.Touchscreen()
while True:
    for touch in ts.poll():
        print(touch.slot, touch.id, touch.valid, touch.x, touch.y)The slot is a number from 0 to 9, denoting which index the touch is at.
The touch id is a unique ID given to the touch by evdev.
Touch valid indicates whether the touch is active- ie: is synonymous to pressed.
Both x and y should be self explanatory!
import ep0510m09
ts = ep0510m09.Touchscreen()
while True:
    for touch in ts.touches:
        print(touch.slot, touch.id, touch.valid, touch.x, touch.y)The slot is a number from 0 to 9, denoting which index the touch is at.
The touch id is a unique ID given to the touch by evdev.
Touch valid indicates whether the touch is active- ie: is synonymous to pressed.
Both x and y should be self explanatory!
Three different kinds of event are generated by ft5406 and ep0510m09:
- Press 
TS_PRESS - Release 
TS_RELEASE - Move 
TS_MOVE 
You can assign handlers to individual touches and events or just use the same handler for all of them.
The example below shows the base minimum you need to set up and handle events. This doesn't even include a GUI- Python will monitor the touchscreen directly.
from ft5406 import Touchscreen, TS_PRESS, TS_RELEASE, TS_MOVE
ts = Touchscreen()
def touch_handler(event, touch):
    if event == TS_PRESS:
        print("Got Press", touch)
    if event == TS_RELEASE:
        print("Got release", touch)
    if event == TS_MOVE:
        print("Got move", touch)
for touch in ts.touches:
    touch.on_press = touch_handler
    touch.on_release = touch_handler
    touch.on_move = touch_handler
ts.run()
while True:
    # Redraw Code etc
    try:
        pass
    except KeyboardInterrupt:
        ts.stop()
        exit()