/usr/share/pymt-examples/apps/mtnotepad/stylus.py is in python-pymt 0.5.1-0ubuntu3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | from pymt import *
class Painter(MTWidget):
def __init__(self, **kwargs):
super(Painter, self).__init__(**kwargs)
self.lines = []
def on_touch_down(self, touch):
if touch.device == 'wm_pen':
touch.userdata['line'] = list(touch.pos)
self.lines.append( touch.userdata['line'] )
return True
def on_touch_move(self, touch):
if touch.device == 'wm_pen':
touch.userdata['line'].extend(touch.pos)
return True
def draw(self):
for line in self.lines:
set_color(0,0,0,0.6)
drawLine(line, width=5)
scatter = MTScatterPlane()
scatter.add_widget(Painter())
runTouchApp(scatter)
|