Tuio: TUIO input provider implementation

Tuio: TUIO input provider implementation

class pymt.input.providers.tuio.TuioTouchProvider(device, args)

Bases: pymt.input.provider.TouchProvider

Tuio provider listen to a socket, and handle part of OSC message

  • /tuio/2Dcur
  • /tuio/2Dobj

Tuio provider can be configured with the [`input]` configuration

[input]
# name = tuio,<ip>:<port>
multitouchtable = tuio,192.168.0.1:3333

You can easily handle new tuio path by extending the providers like this

# Create a class to handle the new touch type
class TuioNEWPATHTouch(Touch):
    def __init__(self, id, args):
        super(TuioNEWPATHTouch, self).__init__(id, args)

    def depack(self, args):
        # Write here the depack function of args.
        # for a simple x, y, value, you can do this :
        if len(args) == 2:
            self.sx, self.sy = args
            self.profile = ('pos', )
        self.sy = 1 - self.sy
        super(TuioNEWPATHTouch, self).depack(args)

# Register it to tuio touch provider
TuioTouchProvider.register('/tuio/NEWPATH', TuioNEWPATHTouch)
static create(oscpath, **kwargs)

Create a touch from a tuio path

static register(oscpath, classname)

Register a new path to handle in tuio provider

start()

Start the tuio provider

stop()

Stop the tuio provider

static unregister(oscpath, classname)

Unregister a new path to handle in tuio provider

update(dispatch_fn)

Update the tuio provider (pop event from the queue)

class pymt.input.providers.tuio.Tuio2dCurTouch(device, id, args)

Bases: pymt.input.providers.tuio.TuioTouch

A 2dCur TUIO touch.

class pymt.input.providers.tuio.Tuio2dObjTouch(device, id, args)

Bases: pymt.input.providers.tuio.TuioTouch

A 2dObj TUIO object.

Previous topic

Probe sysfs: Create input entry for each Multitouch hardware found (linux only).

Next topic

WM_Touch/WM_Pen: common definitions for both input providers

This Page