GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — JJClock/python-multitouch-master at main · grob6000/JJClock

Expand file tree

/

python-multitouch-master

/
Copy path

Directory actions

More options

More options

Directory actions

More options

More options

Latest commit

 

History

History
History
/

python-multitouch-master

/
Copy path

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
examples
examples
 
 
gui
gui
 
 
library
library
 
 
.gitignore
.gitignore
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 
install
install
 
 

README.md

Outline

Python FT5406 Multitouch Driver

Multi-touch pure Python driver for the official 7" touchscreen display.

Beta

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.

Installing

Navigate into the library folder, and run setup like so:

cd library
sudo python3 setup.py install

See the examples folder for usage!

Using The Library

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!

Using Events

Three different kinds of event are generated by ft5406:

  • 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()
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.