GNOME Python API

References

  • PyGObject Docs
  • GNOME Developer Documentation

Libraries

  • Adw
    • Classes
      • AboutDialog
      • AboutWindow
      • ActionRow
      • AlertDialog
      • Animation
      • AnimationTarget
      • Application
      • ApplicationWindow
      • Avatar
      • Banner
      • Bin
      • Breakpoint
      • BreakpointBin
      • ButtonContent
      • CallbackAnimationTarget
      • Carousel
      • CarouselIndicatorDots
      • CarouselIndicatorLines
      • Clamp
      • ClampLayout
      • ClampScrollable
      • ComboRow
      • Dialog
      • EntryRow
      • EnumListItem
      • EnumListModel
      • ExpanderRow
      • Flap
      • HeaderBar
      • Leaflet
      • LeafletPage
      • MessageDialog
      • NavigationPage
      • NavigationSplitView
      • NavigationView
      • OverlaySplitView
      • PasswordEntryRow
      • PreferencesDialog
      • PreferencesGroup
      • PreferencesPage
      • PreferencesRow
      • PreferencesWindow
      • PropertyAnimationTarget
      • SpinRow
      • 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
    • Structures
    • Enums
    • Functions
    • Constants
    • Dependencies
  • DBus
  • DBusGLib
  • Flatpak
  • GLib
  • GModule
  • GObject
  • Gcr
  • Gdk
  • GdkPixbuf
  • GdkPixdata
  • GdkWayland
  • GdkX11
  • Gio
  • Graphene
  • Gsk
  • Gst
  • GstBase
  • GstCheck
  • GstController
  • GstNet
  • Gtk
  • GtkSource
  • HarfBuzz
  • Pango
  • PangoCairo
  • PangoFT2
  • PangoFc
  • PangoOT
  • PangoXft
  • Shumate
  • Soup
  • Vte
  • WebKit
  • WebKitWebProcessExtension
  • Xdp
  • XdpGtk4
  • pycairo
GNOME Python API
  • Adw
  • Classes
  • Carousel
  • View page source

Carousel

class Carousel(**properties: Any)

Superclasses: Widget, InitiallyUnowned, Object

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

Constructors:

Carousel(**properties)
new() -> Gtk.Widget

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

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.n_pages: int

The number of pages in a AdwCarousel.

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)
props.spacing: int

Spacing between pages in pixels.

Signals

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

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.

Parameters:

index – current page


Built with Sphinx using a theme provided by Read the Docs.
  • Carousel
    • 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()