alf
By: a guest | Feb 9th, 2010 | Syntax:
Python | Size: 0.86 KB | Hits: 29 | Expires: Never
# -*- coding: utf-8 -*-
from pymt import *
class TestWidget(MTScatterWidget):
def __init__(self, **kwargs):
super(TestWidget, self).__init__(**kwargs)
self.pos = (0,0)
self.size = (100, 100)
def on_touch_down(self, touch):
print '-------------------------------------'
print 'widget pos: ', self.pos
print 'widget center pos: ', self.center
print 'widget to_local: ', self.to_local(self.x, self.y)
print 'widget to_window: ', self.to_window(self.x, self.y)
print 'widget to_widget: ', self.to_widget(self.x, self.y)
print 'widget.to_parent: ', self.to_parent(self.x, self.y)
super(TestWidget, self).on_touch_down(touch)
if __name__ == "__main__":
button = TestWidget()
window = getWindow()
window.add_widget(button)
runTouchApp()