Skip to main content
Ctrl+K

GNOME Python API

  • GLib
  • Gio
  • GObject
  • Gtk
  • Gdk
  • Adw
    • DBus
    • DBusGLib
    • Flatpak
    • GModule
    • Gcr
    • GdkPixbuf
    • GdkPixdata
    • GdkWayland
    • GdkX11
    • Graphene
    • Gsk
    • Gst
    • GstBase
    • GstCheck
    • GstController
    • GstNet
    • GtkSource
    • HarfBuzz
    • ICal
    • JavaScriptCore
    • Pango
    • PangoCairo
    • PangoFT2
    • PangoFc
    • PangoOT
    • PangoXft
    • Shumate
    • Soup
    • Vte
    • WebKit
    • WebKitWebProcessExtension
    • Xdp
    • XdpGtk4
    • pycairo
  • GLib
  • Gio
  • GObject
  • Gtk
  • Gdk
  • Adw
  • DBus
  • DBusGLib
  • Flatpak
  • GModule
  • Gcr
  • GdkPixbuf
  • GdkPixdata
  • GdkWayland
  • GdkX11
  • Graphene
  • Gsk
  • Gst
  • GstBase
  • GstCheck
  • GstController
  • GstNet
  • GtkSource
  • HarfBuzz
  • ICal
  • JavaScriptCore
  • Pango
  • PangoCairo
  • PangoFT2
  • PangoFc
  • PangoOT
  • PangoXft
  • Shumate
  • Soup
  • Vte
  • WebKit
  • WebKitWebProcessExtension
  • Xdp
  • XdpGtk4
  • pycairo

Section Navigation

API

  • Classes
    • AboutDialog
    • AboutWindow
    • ActionRow
    • AlertDialog
    • Animation
    • AnimationTarget
    • Application
    • ApplicationWindow
    • Avatar
    • Banner
    • Bin
    • BottomSheet
    • Breakpoint
    • BreakpointBin
    • ButtonContent
    • ButtonRow
    • CallbackAnimationTarget
    • Carousel
    • CarouselIndicatorDots
    • CarouselIndicatorLines
    • Clamp
    • ClampLayout
    • ClampScrollable
    • ComboRow
    • Dialog
    • EntryRow
    • EnumListItem
    • EnumListModel
    • ExpanderRow
    • Flap
    • HeaderBar
    • Layout
    • LayoutSlot
    • Leaflet
    • LeafletPage
    • MessageDialog
    • MultiLayoutView
    • NavigationPage
    • NavigationSplitView
    • NavigationView
    • OverlaySplitView
    • PasswordEntryRow
    • PreferencesDialog
    • PreferencesGroup
    • PreferencesPage
    • PreferencesRow
    • PreferencesWindow
    • PropertyAnimationTarget
    • SpinRow
    • Spinner
    • SpinnerPaintable
    • SplitButton
    • SpringAnimation
    • Squeezer
    • SqueezerPage
    • StatusPage
    • StyleManager
    • SwipeTracker
    • SwitchRow
    • TabBar
    • TabButton
    • TabOverview
    • TabPage
    • TabView
    • TimedAnimation
    • Toast
    • ToastOverlay
    • ToolbarView
    • ViewStack
    • ViewStackPage
    • ViewStackPages
    • ViewSwitcher
    • ViewSwitcherBar
    • ViewSwitcherTitle
    • Window
    • WindowTitle
  • Interfaces
    • Swipeable
  • Structures
    • BreakpointCondition
    • SpringParams
  • Enums
    • AccentColor
    • AnimationState
    • BreakpointConditionLengthType
    • BreakpointConditionRatioType
    • CenteringPolicy
    • ColorScheme
    • DialogPresentationMode
    • Easing
    • FlapFoldPolicy
    • FlapTransitionType
    • FoldThresholdPolicy
    • LeafletTransitionType
    • LengthUnit
    • NavigationDirection
    • ResponseAppearance
    • SqueezerTransitionType
    • TabViewShortcuts
    • ToastPriority
    • ToolbarStyle
    • ViewSwitcherPolicy
  • Functions
  • Constants
  • Adw
  • Classes
  • Carousel

Carousel#

class Carousel(**properties: Any)#

Superclasses: Widget, InitiallyUnowned, Object

Implemented Interfaces: Swipeable, Accessible, Buildable, ConstraintTarget, Orientable

A paginated scrolling widget.

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/carousel.png

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#

class Carousel
classmethod new() → Widget#

Creates a new AdwCarousel.

Methods#

class Carousel
append(child: Widget) → None#

Appends child to self.

Parameters:

child – a widget to add

get_allow_long_swipes() → bool#

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

get_allow_mouse_drag() → bool#

Sets whether self can be dragged with mouse pointer.

get_allow_scroll_wheel() → bool#

Gets whether self will respond to scroll wheel events.

get_interactive() → bool#

Gets whether self can be navigated.

get_n_pages() → int#

Gets the number of pages in self.

get_nth_page(n: int) → Widget#

Gets the page at position n.

Parameters:

n – index of the page

get_position() → float#

Gets current scroll position in self, unitless.

1 matches 1 page. Use scroll_to for changing it.

get_reveal_duration() → int#

Gets the page reveal duration, in milliseconds.

get_scroll_params() → SpringParams#

Gets the scroll animation spring parameters for self.

get_spacing() → int#

Gets spacing between pages in pixels.

insert(child: Widget, position: int) → None#

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.

Parameters:
  • child – a widget to add

  • position – the position to insert child at

prepend(child: Widget) → None#

Prepends child to self.

Parameters:

child – a widget to add

remove(child: Widget) → None#

Removes child from self.

Parameters:

child – a widget to remove

reorder(child: Widget, position: int) → None#

Moves child into position position.

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 is TRUE, 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 is FALSE, 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 is FALSE, 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 is FALSE, 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

set_spacing(spacing: int) → None#

Sets spacing between pages in pixels.

Parameters:

spacing – the new spacing value

Properties#

class Carousel
props.allow_long_swipes: bool#

The type of the None singleton.

props.allow_mouse_drag: bool#

The type of the None singleton.

props.allow_scroll_wheel: bool#

The type of the None singleton.

props.interactive: bool#

The type of the None singleton.

props.n_pages: int#

The type of the None singleton.

props.position: float#

The type of the None singleton.

props.reveal_duration: int#

The type of the None singleton.

props.scroll_params: SpringParams#

The type of the None singleton.

props.spacing: int#

The type of the None singleton.

Signals#

class Carousel.signals
page_changed(index: int) → None#

The type of the None singleton.

Parameters:

index – current page

On this page
  • CSS nodes
  • Constructors
    • Carousel.new()
  • Methods
    • Carousel.append()
    • Carousel.get_allow_long_swipes()
    • Carousel.get_allow_mouse_drag()
    • Carousel.get_allow_scroll_wheel()
    • Carousel.get_interactive()
    • Carousel.get_n_pages()
    • Carousel.get_nth_page()
    • Carousel.get_position()
    • Carousel.get_reveal_duration()
    • Carousel.get_scroll_params()
    • Carousel.get_spacing()
    • Carousel.insert()
    • Carousel.prepend()
    • Carousel.remove()
    • Carousel.reorder()
    • Carousel.scroll_to()
    • Carousel.set_allow_long_swipes()
    • Carousel.set_allow_mouse_drag()
    • Carousel.set_allow_scroll_wheel()
    • Carousel.set_interactive()
    • Carousel.set_reveal_duration()
    • Carousel.set_scroll_params()
    • Carousel.set_spacing()
  • Properties
    • Carousel.props.allow_long_swipes
    • Carousel.props.allow_mouse_drag
    • Carousel.props.allow_scroll_wheel
    • Carousel.props.interactive
    • Carousel.props.n_pages
    • Carousel.props.position
    • Carousel.props.reveal_duration
    • Carousel.props.scroll_params
    • Carousel.props.spacing
  • Signals
    • Carousel.signals.page_changed()

This Page

  • Show Source

Created using Sphinx 8.2.3.

General Index

Built with the PyData Sphinx Theme 0.16.1.