• Adw 1 »
  • Classes »
  • Adw.Carousel
  • Adw.Carousel
    • Methods
    • Virtual Methods
    • Properties
    • Signals
    • Fields
    • Class Details
      • Adw.Carousel
        • Adw.Carousel.new()
        • Adw.Carousel.append()
        • Adw.Carousel.get_allow_long_swipes()
        • Adw.Carousel.get_allow_mouse_drag()
        • Adw.Carousel.get_allow_scroll_wheel()
        • Adw.Carousel.get_interactive()
        • Adw.Carousel.get_n_pages()
        • Adw.Carousel.get_nth_page()
        • Adw.Carousel.get_position()
        • Adw.Carousel.get_reveal_duration()
        • Adw.Carousel.get_scroll_params()
        • Adw.Carousel.get_spacing()
        • Adw.Carousel.insert()
        • Adw.Carousel.prepend()
        • Adw.Carousel.remove()
        • Adw.Carousel.reorder()
        • Adw.Carousel.scroll_to()
        • Adw.Carousel.set_allow_long_swipes()
        • Adw.Carousel.set_allow_mouse_drag()
        • Adw.Carousel.set_allow_scroll_wheel()
        • Adw.Carousel.set_interactive()
        • Adw.Carousel.set_reveal_duration()
        • Adw.Carousel.set_scroll_params()
        • Adw.Carousel.set_spacing()
    • Signal Details
      • Adw.Carousel.signals.page_changed()
    • Property Details
      • Adw.Carousel.props.allow_long_swipes
      • Adw.Carousel.props.allow_mouse_drag
      • Adw.Carousel.props.allow_scroll_wheel
      • Adw.Carousel.props.interactive
      • Adw.Carousel.props.n_pages
      • Adw.Carousel.props.position
      • Adw.Carousel.props.reveal_duration
      • Adw.Carousel.props.scroll_params
      • Adw.Carousel.props.spacing
  • Adw 1 »
  • Classes »
  • Adw.Carousel
  • Adw.Carousel
    • Methods
    • Virtual Methods
    • Properties
    • Signals
    • Fields
    • Class Details
      • Adw.Carousel
        • Adw.Carousel.new()
        • Adw.Carousel.append()
        • Adw.Carousel.get_allow_long_swipes()
        • Adw.Carousel.get_allow_mouse_drag()
        • Adw.Carousel.get_allow_scroll_wheel()
        • Adw.Carousel.get_interactive()
        • Adw.Carousel.get_n_pages()
        • Adw.Carousel.get_nth_page()
        • Adw.Carousel.get_position()
        • Adw.Carousel.get_reveal_duration()
        • Adw.Carousel.get_scroll_params()
        • Adw.Carousel.get_spacing()
        • Adw.Carousel.insert()
        • Adw.Carousel.prepend()
        • Adw.Carousel.remove()
        • Adw.Carousel.reorder()
        • Adw.Carousel.scroll_to()
        • Adw.Carousel.set_allow_long_swipes()
        • Adw.Carousel.set_allow_mouse_drag()
        • Adw.Carousel.set_allow_scroll_wheel()
        • Adw.Carousel.set_interactive()
        • Adw.Carousel.set_reveal_duration()
        • Adw.Carousel.set_scroll_params()
        • Adw.Carousel.set_spacing()
    • Signal Details
      • Adw.Carousel.signals.page_changed()
    • Property Details
      • Adw.Carousel.props.allow_long_swipes
      • Adw.Carousel.props.allow_mouse_drag
      • Adw.Carousel.props.allow_scroll_wheel
      • Adw.Carousel.props.interactive
      • Adw.Carousel.props.n_pages
      • Adw.Carousel.props.position
      • Adw.Carousel.props.reveal_duration
      • Adw.Carousel.props.scroll_params
      • Adw.Carousel.props.spacing

Adw.Carousel¶

g Adw.Carousel Adw.Carousel Adw.Swipeable Adw.Swipeable Adw.Swipeable->Adw.Carousel GObject.GInterface GObject.GInterface GObject.GInterface->Adw.Swipeable Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Orientable->Adw.Carousel Gtk.Widget->Adw.Carousel

Subclasses:

None

Methods¶

Inherited:

Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (17), Gtk.Buildable (1), Adw.Swipeable (5), Gtk.Orientable (2)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new ()

append (child)

get_allow_long_swipes ()

get_allow_mouse_drag ()

get_allow_scroll_wheel ()

get_interactive ()

get_n_pages ()

get_nth_page (n)

get_position ()

get_reveal_duration ()

get_scroll_params ()

get_spacing ()

insert (child, position)

prepend (child)

remove (child)

reorder (child, position)

scroll_to (widget, animate)

set_allow_long_swipes (allow_long_swipes)

set_allow_mouse_drag (allow_mouse_drag)

set_allow_scroll_wheel (allow_scroll_wheel)

set_interactive (interactive)

set_reveal_duration (reveal_duration)

set_scroll_params (params)

set_spacing (spacing)

Virtual Methods¶

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9), Adw.Swipeable (5)

Properties¶

Inherited:

Gtk.Widget (35), Gtk.Accessible (1), Gtk.Orientable (1)

Name

Type

Flags

Short Description

allow-long-swipes

bool

r/w/en

allow-mouse-drag

bool

r/w/en

allow-scroll-wheel

bool

r/w/en

interactive

bool

r/w/en

n-pages

int

r

position

float

r

reveal-duration

int

r/w/en

scroll-params

Adw.SpringParams

r/w/en

spacing

int

r/w/en

Signals¶

Inherited:

Gtk.Widget (13), GObject.Object (1)

Name

Short Description

page-changed

This signal is emitted after a page has been changed.

Fields¶

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details¶

class Adw.Carousel(**kwargs)¶
Bases:

Gtk.Widget, Adw.Swipeable, Gtk.Orientable

Abstract:

No

Structure:

Adw.CarouselClass

A paginated scrolling widget.

<picture> <source srcset=”carousel-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”carousel.png” alt=”carousel”> </picture>

The AdwCarousel widget can be used to display a set of pages with swipe-based navigation between them.

[class`CarouselIndicatorDots`] and [class`CarouselIndicatorLines`] can be used to provide page indicators for AdwCarousel.

CSS nodes

AdwCarousel has a single CSS node with name carousel.

classmethod new()¶
Returns:

the newly created AdwCarousel

Return type:

Gtk.Widget

Creates a new AdwCarousel.

append(child)¶
Parameters:

child (Gtk.Widget) – a widget to add

Appends child to self.

get_allow_long_swipes()¶
Returns:

TRUE if long swipes are allowed

Return type:

bool

Gets whether to allow swiping for more than one page at a time.

get_allow_mouse_drag()¶
Returns:

whether self can be dragged with mouse pointer

Return type:

bool

Sets whether self can be dragged with mouse pointer.

get_allow_scroll_wheel()¶
Returns:

TRUE if self will respond to scroll wheel events

Return type:

bool

Gets whether self will respond to scroll wheel events.

get_interactive()¶
Returns:

whether self can be navigated

Return type:

bool

Gets whether self can be navigated.

get_n_pages()¶
Returns:

the number of pages in self

Return type:

int

Gets the number of pages in self.

get_nth_page(n)¶
Parameters:

n (int) – index of the page

Returns:

the page

Return type:

Gtk.Widget

Gets the page at position n.

get_position()¶
Returns:

the scroll position

Return type:

float

Gets current scroll position in self, unitless.

1 matches 1 page. Use [method`Carousel`.scroll_to] for changing it.

get_reveal_duration()¶
Returns:

the duration

Return type:

int

Gets the page reveal duration, in milliseconds.

get_scroll_params()¶
Returns:

the animation parameters

Return type:

Adw.SpringParams

Gets the scroll animation spring parameters for self.

get_spacing()¶
Returns:

spacing between pages

Return type:

int

Gets spacing between pages in pixels.

insert(child, position)¶
Parameters:
  • child (Gtk.Widget) – a widget to add

  • position (int) – the position to insert child at

Inserts child into self at position position.

If position is -1, or larger than the number of pages, child will be appended to the end.

prepend(child)¶
Parameters:

child (Gtk.Widget) – a widget to add

Prepends child to self.

remove(child)¶
Parameters:

child (Gtk.Widget) – a widget to remove

Removes child from self.

reorder(child, position)¶
Parameters:
  • child (Gtk.Widget) – a widget to add

  • position (int) – the position to move child to

Moves child into position position.

If position is -1, or larger than the number of pages, child will be moved at the end.

scroll_to(widget, animate)¶
Parameters:
  • widget (Gtk.Widget) – a child of self

  • animate (bool) – whether to animate the transition

Scrolls to widget.

If animate is TRUE, the transition will be animated.

set_allow_long_swipes(allow_long_swipes)¶
Parameters:

allow_long_swipes (bool) – whether to allow long swipes

Sets whether to allow swiping for more than one page at a time.

If allow_long_swipes is FALSE, each swipe can only move to the adjacent pages.

set_allow_mouse_drag(allow_mouse_drag)¶
Parameters:

allow_mouse_drag (bool) – whether self can be dragged with mouse pointer

Sets whether self can be dragged with mouse pointer.

If allow_mouse_drag is FALSE, dragging is only available on touch.

set_allow_scroll_wheel(allow_scroll_wheel)¶
Parameters:

allow_scroll_wheel (bool) – whether self will respond to scroll wheel events

Sets whether self will respond to scroll wheel events.

If allow_scroll_wheel is FALSE, wheel events will be ignored.

set_interactive(interactive)¶
Parameters:

interactive (bool) – whether self can be navigated

Sets whether self can be navigated.

This can be used to temporarily disable the carousel to only allow navigating it in a certain state.

set_reveal_duration(reveal_duration)¶
Parameters:

reveal_duration (int) – the new reveal duration value

Sets the page reveal duration, in milliseconds.

Reveal duration is used when animating adding or removing pages.

set_scroll_params(params)¶
Parameters:

params (Adw.SpringParams) – the new parameters

Sets the scroll animation spring parameters for self.

The default value is equivalent to:

``c adw_spring_params_new (1, 0.5, 500) ``

set_spacing(spacing)¶
Parameters:

spacing (int) – the new spacing value

Sets spacing between pages in pixels.

Signal Details¶

Adw.Carousel.signals.page_changed(carousel, index)¶
Signal Name:

page-changed

Flags:

RUN_LAST

Parameters:
  • carousel (Adw.Carousel) – The object which received the signal

  • index (int) – current page

This signal is emitted after a page has been changed.

It can be used to implement “infinite scrolling” by amending the pages after every scroll.

::: note An empty carousel is indicated by (int)index == -1.

Property Details¶

Adw.Carousel.props.allow_long_swipes¶
Name:

allow-long-swipes

Type:

bool

Default Value:

False

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

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.

Adw.Carousel.props.allow_mouse_drag¶
Name:

allow-mouse-drag

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Sets whether the AdwCarousel can be dragged with mouse pointer.

If the value is FALSE, dragging is only available on touch.

Adw.Carousel.props.allow_scroll_wheel¶
Name:

allow-scroll-wheel

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the widget will respond to scroll wheel events.

If the value is FALSE, wheel events will be ignored.

Adw.Carousel.props.interactive¶
Name:

interactive

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Whether the carousel can be navigated.

This can be used to temporarily disable the carousel to only allow navigating it in a certain state.

Adw.Carousel.props.n_pages¶
Name:

n-pages

Type:

int

Default Value:

0

Flags:

READABLE

The number of pages in a AdwCarousel.

Adw.Carousel.props.position¶
Name:

position

Type:

float

Default Value:

0.0

Flags:

READABLE

Current scrolling position, unitless.

1 matches 1 page. Use [method`Carousel`.scroll_to] for changing it.

Adw.Carousel.props.reveal_duration¶
Name:

reveal-duration

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Page reveal duration, in milliseconds.

Reveal duration is used when animating adding or removing pages.

Adw.Carousel.props.scroll_params¶
Name:

scroll-params

Type:

Adw.SpringParams

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Scroll animation spring parameters.

The default value is equivalent to:

``c adw_spring_params_new (1, 0.5, 500) ``

Adw.Carousel.props.spacing¶
Name:

spacing

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Spacing between pages in pixels.