PyMT Scatter Video Widget

For anyone contemplating writing a multi-touch application, PyMT can be a fun and easy way to see instant results. Its API offers several useful widgets that allows for fast prototyping. With that said, PyMT should not be used for a commercial or high performance applications, as it has some major limitations with its inheritance architecture and screen paint logic (plus it comes with a GPL license). Some of these issues have been addressed in the teams rewrite of PyMT called Kivy. Although Kivy appears promising, it is still in its infancy and will need a few more release iterations before being adopted by the masses.

The weakest PyMT widget is by far the video player. Its integration with gstreamer is not nearly as complete as PyQt and it doesn’t have full multi-touch support. To address the multi-touch issue I wrote the following code snippet for one of Immersive’s first early stage in store product browser. It adds a default picture when the video is at position 0 and superimposes a “play” button when paused. In addition it uses the MTScatter widget as its base class which allows the user to manipulate the video using full multi-touch gestures when playing.

class scatVid(MTScatter):
    def __init__(self, filename, image, **kwargs):
        # image is a pre-constructed Image( ) object to be used at start of video
        super(scatVid, self).__init__(**kwargs)
        self.image = MTImage(image) = MTImage(Image('./play_button.png'))
        self._posXY = None = MTVideo(filename=filename, eos='loop') = 10
        connect(, 'on_resize', self, 'size')
        connect(, 'on_resize', self.image, 'size')
        connect(, 'on_resize',, 'size')

        self._state = ""

    def stop(self):

    def play(self):

    def hide(self):
        super(scatVid, self).hide()

    def show(self):
        super(scatVid, self).show()

    def _get_state(self):

    def _get_posXY(self):
        return self._posXY
    def _set_posXY(self, x, y):
        print "setting posXY: %dx%d" %(x,y)

    def draw(self):
        super(scatVid, self).draw()
        if self.state != "playing":
            if < 2:

    state = property(lambda self: self._get_state(),
            doc='Get the video playing status')

To see the above code in action look here. You can use any play button piece of artwork, but for your convince here is the one I used.