Version

Quick search

Table Of Contents

Scroll effect

New in version 1.7.0.

Based on the kinetic effect, the ScrollEffect will limit the movement to bounds determined by its min and max properties. If the movement exceeds these bounds, it will calculate the amount of overscroll and try to return to the value of one of the bounds.

This is very useful for implementing a scrolling list. We actually use this class as a base effect for our ScrollView widget.

class kivy.effects.scroll.ScrollEffect(**kwargs)[source]

Bases: kivy.effects.kinetic.KineticEffect

ScrollEffect class. See the module documentation for more information.

displacement

Cumulative distance of the movement during the interaction. This is used to determine if the movement is a drag (more than drag_threshold) or not.

displacement is a NumericProperty and defaults to 0.

drag_threshold

Minimum distance to travel before the movement is considered as a drag.

drag_threshold is a NumericProperty and defaults to 20sp.

max

Maximum boundary to use for scrolling.

max is a NumericProperty and defaults to 0.

min

Minimum boundary to use for scrolling.

min is a NumericProperty and defaults to 0.

overscroll

Computed value when the user over-scrolls i.e. goes out of the bounds.

overscroll is a NumericProperty and defaults to 0.

reset(pos)[source]

(internal) Reset the value and the velocity to the pos. Mostly used when the bounds are checked.

scroll

Computed value for scrolling. This value is different from kivy.effects.kinetic.KineticEffect.value in that it will return to one of the min/max bounds.

scroll is a NumericProperty and defaults to 0.

start(val, t=None)[source]

Start the movement.

Parameters
val: float or int

Value of the movement

t: float, defaults to None

Time when the movement happen. If no time is set, it will use time.time()

stop(val, t=None)[source]

Stop the movement.

See start() for the arguments.

target_widget

Widget to attach to this effect. Even if this class doesn’t make changes to the target_widget by default, subclasses can use it to change the graphics or apply custom transformations.

target_widget is a ObjectProperty and defaults to None.

update(val, t=None)[source]

Update the movement.

See start() for the arguments.