Skip to main content

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++

https://www.tuio.org/?cpp

Installation

pip3 install python-tuio

Usage

Server example with Cursor

    from pythontuio import TuioServer
    from pythontuio import Cursor

    server = TuioServer()
    cursor = Cursor(123) # sets session_id to 123

    cursor.velocity             = (0.2,0.1)
    cursor.motion_acceleration  = 0.1 

    server.cursors.append(cursor)
    i = 0
    while i < 10:
        i+=1
        cursor.position = (0.5+0.01*i,0.5)

        server.send_bundle()
        time.sleep(0.1)

Client example with class and extends

    from pythontuio import TuioClient
    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 TuioClient
    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.

GitHub

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.9.tar.gz (5.7 kB view details)

Uploaded Source

Built Distribution

python_tuio-0.0.9-py3-none-any.whl (7.9 kB view details)

Uploaded Python 3

File details

Details for the file python-tuio-0.0.9.tar.gz.

File metadata

  • Download URL: python-tuio-0.0.9.tar.gz
  • Upload date:
  • Size: 5.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for python-tuio-0.0.9.tar.gz
Algorithm Hash digest
SHA256 12eeb9e62010d7b8db0baa6ea6cb23ca3e944963ae358994d8db7e3ceb24b97e
MD5 c7c43f6fab63048f048d52d4559f362f
BLAKE2b-256 2c83e963489c6de2bfb31cf78982c3bee216ba105de4ef52f4e70d843fe0079c

See more details on using hashes here.

File details

Details for the file python_tuio-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: python_tuio-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 7.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/53.0.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.7.9

File hashes

Hashes for python_tuio-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 886a648a8d75e94ad68e8cb3baf1d956ed11d4080c0790dfc78679d0f363b390
MD5 7bee3d61261bc5b9d8e411af5a3c7b6c
BLAKE2b-256 554b5b719b39c5f26ab0df56b6215c6e82a05b6655d5ed3c9b7c710ecff031ec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page