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_to
for changing it.
- get_scroll_params() SpringParams
Gets the scroll animation spring parameters for
self
.
- insert(child: Widget, position: int) None
Inserts
child
intoself
at positionposition
.If position is -1, or larger than the number of pages,
child
will be appended to the end.- Parameters:
child – a widget to add
position – the position to insert
child
at
- reorder(child: Widget, position: int) None
Moves
child
into positionposition
.If position is -1, or larger than the number of pages,
child
will be moved at the end.- Parameters:
child – a widget to add
position – the position to move
child
to
- scroll_to(widget: Widget, animate: bool) None
Scrolls to
widget
.If
animate
isTRUE
, the transition will be animated.- Parameters:
widget – a child of
self
animate – 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_swipes
isFALSE
, 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
self
can be dragged with mouse pointer.If
allow_mouse_drag
isFALSE
, dragging is only available on touch.- Parameters:
allow_mouse_drag – whether
self
can be dragged with mouse pointer
- set_allow_scroll_wheel(allow_scroll_wheel: bool) None
Sets whether
self
will respond to scroll wheel events.If
allow_scroll_wheel
isFALSE
, wheel events will be ignored.- Parameters:
allow_scroll_wheel – whether
self
will respond to scroll wheel events
- set_interactive(interactive: bool) None
Sets whether
self
can be navigated.This can be used to temporarily disable the carousel to only allow navigating it in a certain state.
- Parameters:
interactive – whether
self
can 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.allow_long_swipes: bool
Whether to allow swiping for more than one page at a time.
If the value is
FALSE
, each swipe can only move to the adjacent pages.
- props.allow_mouse_drag: bool
Sets whether the
AdwCarousel
can be dragged with mouse pointer.If the value is
FALSE
, dragging is only available on touch.
- props.allow_scroll_wheel: bool
Whether the widget will respond to scroll wheel events.
If the value is
FALSE
, wheel events will be ignored.
- props.interactive: bool
Whether the carousel can be navigated.
This can be used to temporarily disable the carousel to only allow navigating it in a certain state.
- props.position: float
Current scrolling position, unitless.
1 matches 1 page. Use
scroll_to
for changing it.
- props.reveal_duration: int
Page reveal duration, in milliseconds.
Reveal duration is used when animating adding or removing pages.
- props.scroll_params: SpringParams
Scroll animation spring parameters.
The default value is equivalent to:
adw_spring_params_new (1, 0.5, 500)