Carousel#
Superclasses: Widget, InitiallyUnowned, Object
Implemented Interfaces: Swipeable, Accessible, Buildable, ConstraintTarget, Orientable
A paginated scrolling widget.
The AdwCarousel widget can be used to display a set of pages with
swipe-based navigation between them.
CarouselIndicatorDots and CarouselIndicatorLines can be used
to provide page indicators for AdwCarousel.
CSS nodes#
AdwCarousel has a single CSS node with name carousel.
Constructors#
Methods#
- class Carousel
-
- get_position() float#
Gets current scroll position in
self, unitless.1 matches 1 page. Use
scroll_tofor changing it.
- get_scroll_params() SpringParams#
Gets the scroll animation spring parameters for
self.
- insert(child: Widget, position: int) None#
Inserts
childintoselfat positionposition.If position is -1, or larger than the number of pages,
childwill be appended to the end.- Parameters:
child – a widget to add
position – the position to insert
childat
- reorder(child: Widget, position: int) None#
Moves
childinto positionposition.If position is -1, or larger than the number of pages,
childwill be moved at the end.- Parameters:
child – a widget to add
position – the position to move
childto
- scroll_to(widget: Widget, animate: bool) None#
Scrolls to
widget.If
animateisTRUE, the transition will be animated.- Parameters:
widget – a child of
selfanimate – whether to animate the transition
- set_allow_long_swipes(allow_long_swipes: bool) None#
Sets whether to allow swiping for more than one page at a time.
If
allow_long_swipesisFALSE, each swipe can only move to the adjacent pages.- Parameters:
allow_long_swipes – whether to allow long swipes
- set_allow_mouse_drag(allow_mouse_drag: bool) None#
Sets whether
selfcan be dragged with mouse pointer.If
allow_mouse_dragisFALSE, dragging is only available on touch.- Parameters:
allow_mouse_drag – whether
selfcan be dragged with mouse pointer
- set_allow_scroll_wheel(allow_scroll_wheel: bool) None#
Sets whether
selfwill respond to scroll wheel events.If
allow_scroll_wheelisFALSE, wheel events will be ignored.- Parameters:
allow_scroll_wheel – whether
selfwill respond to scroll wheel events
- set_interactive(interactive: bool) None#
Sets whether
selfcan be navigated.This can be used to temporarily disable the carousel to only allow navigating it in a certain state.
- Parameters:
interactive – whether
selfcan be navigated
- set_reveal_duration(reveal_duration: int) None#
Sets the page reveal duration, in milliseconds.
Reveal duration is used when animating adding or removing pages.
- Parameters:
reveal_duration – the new reveal duration value
- set_scroll_params(params: SpringParams) None#
Sets the scroll animation spring parameters for
self.The default value is equivalent to:
adw_spring_params_new (1, 0.5, 500)
- Parameters:
params – the new parameters
Properties#
- class Carousel
-
- props.scroll_params: SpringParams#
The type of the None singleton.