Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def on_touch_down(self, touch):
- '''Receive a touch down event.
- :Parameters:
- `touch`: :class:`~kivy.input.motionevent.MotionEvent` class
- Touch received. The touch is in parent coordinates. See
- :mod:`~kivy.uix.relativelayout` for a discussion on
- coordinate systems.
- :Returns: bool
- If True, the dispatching of the touch event will stop.
- If False, the event will continue to be dispatched to the rest
- of the widget tree.
- '''
- if self.disabled and self.collide_point(*touch.pos):
- print("self={} is disabled, not dispatching".format(self))
- return True
- for child in self.children[:]:
- print("--- dispatch to {}".format(child))
- if child.dispatch('on_touch_down', touch):
- return True
- # This is the output of pressing the button initially
- '''
- --- dispatch to <kivy.uix.stacklayout.StackLayout object at 0x7fd64d5bd8d0>
- --- dispatch to <kivy.uix.button.Button object at 0x7fd64da571e8>
- --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bdc10>
- --- dispatch to <kivy.uix.boxlayout.BoxLayout object at 0x7fd64d5bda08>
- --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bdba8>
- --- dispatch to <kivy.uix.relativelayout.RelativeLayout object at 0x7fd64d5bdad8>
- --- dispatch to <kivy.uix.widget.Widget object at 0x7fd64d5bdb40>
- --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bd9a0>
- --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bda70>
- --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bd938>
- '''
- # This is the output of second press
- '''
- --- dispatch to <kivy.uix.stacklayout.StackLayout object at 0x7fd64d5bd8d0>
- --- dispatch to <kivy.uix.button.Button object at 0x7fd64da571e8>
- --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bdc10>
- --- dispatch to <kivy.uix.boxlayout.BoxLayout object at 0x7fd64d5bda08>
- --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bdba8>
- --- dispatch to <kivy.uix.relativelayout.RelativeLayout object at 0x7fd64d5bdad8>
- self=<kivy.uix.relativelayout.RelativeLayout object at 0x7fd64d5bdad8> is disabled, not dispatching
- '''
Add Comment
Please, Sign In to add comment