python3 implementation of the TUIO protocol
Project description
TUIO for Python3
TUIO protokoll implementation based on OSC protocol. It is implemented with the python-osc
libary.
TUIO spezification
http://www.tuio.org/?specification
OSC spezification
http://opensoundcontrol.org/spec-1_0 and https://python-osc.readthedocs.io/en/latest/
API example of C++
Installation
pip3 install python-tuio
Note
Listener is implemented very minimalistic. More to be continue. Feel free to contribute.
Usage
Server example with Cursor
from pythontuio import TuioClient
from pythontuio import Cursor
cursor = Cursor(123) # sets session_id to 123
cursor.velocity = (0.2,0.1)
cursor.motion_acceleration = 0.1
client.cursors.append(cursor)
i = 0
while i < 10:
i+=1
cursor.position = (0.5+0.01*i,0.5)
client.send_bundle()
time.sleep(0.1)
Client example with class and extends
from pythontuio import TuioServer
from pythontuio import Cursor
from pythontuio import TuioListener
from threading import Thread
class MyListener(TuioListener):
def add_tuio_cursor(self, cursor: Cursor):
print("detect a new Cursor")
(...)
client = TuioClient(("localhost",3333))
t = Thread(target=client.start)
listener = MyListener()
client.add_listener(listener)
t.start()
Client example with lamda
from pythontuio import TuioServer
from pythontuio import Cursor
from pythontuio import TuioListener
from threading import Thread
def _add_tuio_cursor(self, cursor: Cursor):
print("detect a new Cursor")
(...)
client = TuioClient(("localhost",3333))
t = Thread(target=client.start)
listener = TuioListener()
listener.add_tuio_cursor = _add_tuio_cursor
client.add_listener(listener)
t.start()
Contribution
Feel free to contribute inputs. Just start a MR with your changes.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
python-tuio-0.0.6.tar.gz
(5.6 kB
view hashes)
Built Distribution
Close
Hashes for python_tuio-0.0.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | edbd8800ac24b539ce87a745f1b61dfe1a04430677eca175bec339f6c008d2b0 |
|
MD5 | 713693cbb973a9fa4cdc0df38afef4a3 |
|
BLAKE2b-256 | 23110bf0fca870e4f6436320089d13c700df016a921cfad3d20979b13fc95c93 |