Guest User

Untitled

a guest
Apr 23rd, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.16 KB | None | 0 0
  1. def on_touch_down(self, touch):
  2. '''Receive a touch down event.
  3.  
  4. :Parameters:
  5. `touch`: :class:`~kivy.input.motionevent.MotionEvent` class
  6. Touch received. The touch is in parent coordinates. See
  7. :mod:`~kivy.uix.relativelayout` for a discussion on
  8. coordinate systems.
  9.  
  10. :Returns: bool
  11. If True, the dispatching of the touch event will stop.
  12. If False, the event will continue to be dispatched to the rest
  13. of the widget tree.
  14. '''
  15. if self.disabled and self.collide_point(*touch.pos):
  16. print("self={} is disabled, not dispatching".format(self))
  17. return True
  18. for child in self.children[:]:
  19. print("--- dispatch to {}".format(child))
  20. if child.dispatch('on_touch_down', touch):
  21. return True
  22.  
  23.  
  24. # This is the output of pressing the button initially
  25. '''
  26. --- dispatch to <kivy.uix.stacklayout.StackLayout object at 0x7fd64d5bd8d0>
  27. --- dispatch to <kivy.uix.button.Button object at 0x7fd64da571e8>
  28. --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bdc10>
  29. --- dispatch to <kivy.uix.boxlayout.BoxLayout object at 0x7fd64d5bda08>
  30. --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bdba8>
  31. --- dispatch to <kivy.uix.relativelayout.RelativeLayout object at 0x7fd64d5bdad8>
  32. --- dispatch to <kivy.uix.widget.Widget object at 0x7fd64d5bdb40>
  33. --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bd9a0>
  34. --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bda70>
  35. --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bd938>
  36. '''
  37.  
  38. # This is the output of second press
  39. '''
  40. --- dispatch to <kivy.uix.stacklayout.StackLayout object at 0x7fd64d5bd8d0>
  41. --- dispatch to <kivy.uix.button.Button object at 0x7fd64da571e8>
  42. --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bdc10>
  43. --- dispatch to <kivy.uix.boxlayout.BoxLayout object at 0x7fd64d5bda08>
  44. --- dispatch to <kivy.uix.button.Button object at 0x7fd64d5bdba8>
  45. --- dispatch to <kivy.uix.relativelayout.RelativeLayout object at 0x7fd64d5bdad8>
  46. self=<kivy.uix.relativelayout.RelativeLayout object at 0x7fd64d5bdad8> is disabled, not dispatching
  47. '''
Add Comment
Please, Sign In to add comment