Dragable Widget

Mathieu Virbel edited this page Sep 27, 2013 · 1 revision
#!Python
class DragableObject( Widget ):
    def on_touch_down( self, touch ):
        if self.collide_point( *touch.pos ):
            touch.grab( self )
            return True
    
    def on_touch_up( self, touch ):
        if touch.grab_current is self:
            touch.ungrab( self )
            return True
    
    def on_touch_move( self, touch ):
        if touch.grab_current is self:
            self.pos = touch.x-self.width/2, touch.y-self.height/2
Clone this wiki locally
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.