Guest
Public paste!

alf

By: a guest | Feb 9th, 2010 | Syntax: Python | Size: 0.86 KB | Hits: 29 | Expires: Never
Copy text to clipboard
  1. # -*- coding: utf-8 -*-
  2.  
  3. from pymt import *
  4.  
  5. class TestWidget(MTScatterWidget):
  6.  
  7.     def __init__(self, **kwargs):
  8.  
  9.         super(TestWidget, self).__init__(**kwargs)
  10.  
  11.         self.pos = (0,0)
  12.         self.size = (100, 100)
  13.  
  14.     def on_touch_down(self, touch):
  15.  
  16.         print '-------------------------------------'
  17.         print 'widget pos: ', self.pos
  18.         print 'widget center pos: ', self.center
  19.         print 'widget to_local: ', self.to_local(self.x, self.y)
  20.         print 'widget to_window: ', self.to_window(self.x, self.y)
  21.         print 'widget to_widget: ', self.to_widget(self.x, self.y)
  22.         print 'widget.to_parent: ', self.to_parent(self.x, self.y)
  23.  
  24.         super(TestWidget, self).on_touch_down(touch)
  25.  
  26. if __name__ == "__main__":
  27.  
  28.     button = TestWidget()
  29.  
  30.     window = getWindow()
  31.     window.add_widget(button)
  32.     runTouchApp()