Table Of Contents
See DragBehavior for details.¶
-
class
kivy.uix.behaviors.drag.DragBehavior(**kwargs)[source]¶ Bases:
objectThis mixin class provides Drag behavior. When combined with a widget, dragging in the rectangle defined by
drag_rectanglewill drag the widget.For example, to make a popup which is draggable by its title do:
from kivy.uix.behaviors import DragBehavior from kivy.uix.popup import Popup class DragPopup(DragBehavior, Popup): pass
And in .kv do:
<DragPopup>: drag_rectangle: self.x, self.y+self._container.height, self.width, self.height - self._container.height drag_timeout: 10000000 drag_distance: 0
New in version 1.8.0.
-
drag_distance¶ Distance to move before dragging the
DragBehavior, in pixels. As soon as the distance has been traveled, theDragBehaviorwill start to drag, and no touch event will be dispatched to the children. It is advisable that you base this value on the dpi of your target device’s screen.drag_distanceis aNumericPropertyand defaults to the scroll_distance as defined in the userConfig(20 pixels by default).
-
drag_rect_height¶ Height of the axis aligned bounding rectangle where dragging is allowed.
drag_rect_heightis aNumericPropertyand defaults to 100.
-
drag_rect_width¶ Width of the axis aligned bounding rectangle where dragging is allowed.
drag_rect_widthis aNumericPropertyand defaults to 100.
-
drag_rect_x¶ X position of the axis aligned bounding rectangle where dragging is allowed (in window coordinates).
drag_rect_xis aNumericPropertyand defaults to 0.
-
drag_rect_y¶ Y position of the axis aligned bounding rectangle where dragging is allowed (in window coordinates).
drag_rect_Yis aNumericPropertyand defaults to 0.
-
drag_rectangle¶ Position and size of the axis aligned bounding rectangle where dragging is allowed.
drag_rectangleis aReferenceListPropertyof (drag_rect_x,drag_rect_y,drag_rect_width,drag_rect_height) properties.
-
drag_timeout¶ Timeout allowed to trigger the
drag_distance, in milliseconds. If the user has not moveddrag_distancewithin the timeout, dragging will be disabled, and the touch event will be dispatched to the children.drag_timeoutis aNumericPropertyand defaults to the scroll_timeout as defined in the userConfig(55 milliseconds by defaut).
-