Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Short Answer</strong></p> <p>You can simple use an <code>Scatter</code>. It includes dragging, rotation and scaling functionality and you can deactivate any or all of them:</p> <pre><code>my_scatter = Scatter(do_rotation=False, do_scale=False) </code></pre> <p>None of the problems you described should happen inside a <code>Scatter</code></p> <p><strong>Long Answer</strong></p> <p>Your problem is that you are overriding the <code>on_touch_down</code>, <code>on_touch_move</code> and <code>on_touch_up</code> of the parent. </p> <p>Normally these methods will call the corresponding ones of the children. For example, when the <code>on_touch_down</code> method of a <code>Widget</code> instance is called, then the <code>Widget</code> instance is going to traverse its children, calling the <code>on_touch_down</code> method of each of then (If you are familiarized with recursion and tree structures, we are talking about a recursive traverse method - I think pre-order - <a href="http://en.wikipedia.org/wiki/Tree_traversal">Tree traversal</a>). </p> <p>This functionality is overridden in the DraggableObject class. <strong>You got to be sure to call the method of be base class with:</strong></p> <p>super(DraggableWidget, self).on_touch_down(touch)</p> <p>Depending on what is the behaviour you are looking for the methods could look like:</p> <p>(1) If you always want to call the children:</p> <pre><code>def on_touch_down( self, touch ): if self.collide_point( *touch.pos ): touch.grab( self ) return super(DraggableWidget, self).on_touch_down(touch) </code></pre> <p>(2) If you just want to call the children when there is no collide:</p> <pre><code>def on_touch_down( self, touch ): if self.collide_point( *touch.pos ): touch.grab( self ) return True # Don't call the on_touch_down of the Base Class return super(DraggableWidget, self).on_touch_down(touch) </code></pre> <p>And there is more options!. The return value indicates if the event was or not handled by any children. You can, for example, do something like this:</p> <pre><code>def on_touch_down( self, touch ): handled = super(DraggableWidget, self).on_touch_down(touch) if not handled and self.collide_point( *touch.pos ): touch.grab( self ) return True return handled </code></pre> <p>In this case, you will avoid the Widget to be dragged when one of the children handle the event. It all depends on what you do.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload