• Handy 1 »
  • Classes »
  • Handy.Carousel
  • Handy.Carousel
    • Methods
    • Virtual Methods
    • Properties
    • Style Properties
    • Signals
    • Fields
    • Class Details
      • Handy.Carousel
        • Handy.Carousel.new()
        • Handy.Carousel.get_allow_long_swipes()
        • Handy.Carousel.get_allow_mouse_drag()
        • Handy.Carousel.get_allow_scroll_wheel()
        • Handy.Carousel.get_animation_duration()
        • Handy.Carousel.get_interactive()
        • Handy.Carousel.get_n_pages()
        • Handy.Carousel.get_position()
        • Handy.Carousel.get_reveal_duration()
        • Handy.Carousel.get_spacing()
        • Handy.Carousel.insert()
        • Handy.Carousel.prepend()
        • Handy.Carousel.reorder()
        • Handy.Carousel.scroll_to()
        • Handy.Carousel.scroll_to_full()
        • Handy.Carousel.set_allow_long_swipes()
        • Handy.Carousel.set_allow_mouse_drag()
        • Handy.Carousel.set_allow_scroll_wheel()
        • Handy.Carousel.set_animation_duration()
        • Handy.Carousel.set_interactive()
        • Handy.Carousel.set_reveal_duration()
        • Handy.Carousel.set_spacing()
    • Signal Details
      • Handy.Carousel.signals.page_changed()
    • Property Details
      • Handy.Carousel.props.allow_long_swipes
      • Handy.Carousel.props.allow_mouse_drag
      • Handy.Carousel.props.allow_scroll_wheel
      • Handy.Carousel.props.animation_duration
      • Handy.Carousel.props.interactive
      • Handy.Carousel.props.n_pages
      • Handy.Carousel.props.position
      • Handy.Carousel.props.reveal_duration
      • Handy.Carousel.props.spacing
  • Handy 1 »
  • Classes »
  • Handy.Carousel
  • Handy.Carousel
    • Methods
    • Virtual Methods
    • Properties
    • Style Properties
    • Signals
    • Fields
    • Class Details
      • Handy.Carousel
        • Handy.Carousel.new()
        • Handy.Carousel.get_allow_long_swipes()
        • Handy.Carousel.get_allow_mouse_drag()
        • Handy.Carousel.get_allow_scroll_wheel()
        • Handy.Carousel.get_animation_duration()
        • Handy.Carousel.get_interactive()
        • Handy.Carousel.get_n_pages()
        • Handy.Carousel.get_position()
        • Handy.Carousel.get_reveal_duration()
        • Handy.Carousel.get_spacing()
        • Handy.Carousel.insert()
        • Handy.Carousel.prepend()
        • Handy.Carousel.reorder()
        • Handy.Carousel.scroll_to()
        • Handy.Carousel.scroll_to_full()
        • Handy.Carousel.set_allow_long_swipes()
        • Handy.Carousel.set_allow_mouse_drag()
        • Handy.Carousel.set_allow_scroll_wheel()
        • Handy.Carousel.set_animation_duration()
        • Handy.Carousel.set_interactive()
        • Handy.Carousel.set_reveal_duration()
        • Handy.Carousel.set_spacing()
    • Signal Details
      • Handy.Carousel.signals.page_changed()
    • Property Details
      • Handy.Carousel.props.allow_long_swipes
      • Handy.Carousel.props.allow_mouse_drag
      • Handy.Carousel.props.allow_scroll_wheel
      • Handy.Carousel.props.animation_duration
      • Handy.Carousel.props.interactive
      • Handy.Carousel.props.n_pages
      • Handy.Carousel.props.position
      • Handy.Carousel.props.reveal_duration
      • Handy.Carousel.props.spacing

Handy.Carousel¶

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.Orientable Gtk.Orientable GObject.GInterface->Gtk.Orientable Handy.Swipeable Handy.Swipeable GObject.GInterface->Handy.Swipeable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Bin Gtk.Bin Gtk.EventBox Gtk.EventBox Gtk.Bin->Gtk.EventBox Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Handy.Carousel Handy.Carousel Gtk.EventBox->Handy.Carousel Gtk.Orientable->Handy.Carousel Gtk.Widget->Gtk.Container Handy.Swipeable->Handy.Carousel

Subclasses:

None

Methods¶

Inherited:

Gtk.EventBox (5), Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10), Gtk.Orientable (2), Handy.Swipeable (8)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class

new ()

get_allow_long_swipes ()

get_allow_mouse_drag ()

get_allow_scroll_wheel ()

get_animation_duration ()

get_interactive ()

get_n_pages ()

get_position ()

get_reveal_duration ()

get_spacing ()

insert (child, position)

prepend (child)

reorder (child, position)

scroll_to (widget)

scroll_to_full (widget, duration)

set_allow_long_swipes (allow_long_swipes)

set_allow_mouse_drag (allow_mouse_drag)

set_allow_scroll_wheel (allow_scroll_wheel)

set_animation_duration (duration)

set_interactive (interactive)

set_reveal_duration (reveal_duration)

set_spacing (spacing)

Virtual Methods¶

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10), Handy.Swipeable (7)

Properties¶

Inherited:

Gtk.EventBox (2), Gtk.Container (3), Gtk.Widget (39), Gtk.Orientable (1)

Name

Type

Flags

Short Description

allow-long-swipes

bool

r/w/en

Whether to allow swiping for more than one page at a time

allow-mouse-drag

bool

r/w/en

Whether to allow dragging with mouse pointer

allow-scroll-wheel

bool

r/w/en

Whether the widget will respond to scroll wheel events

animation-duration

int

r/w/en

Default animation duration

interactive

bool

r/w/en

Whether the widget can be swiped

n-pages

int

r/en

Number of pages

position

float

r/en

Current scrolling position

reveal-duration

int

r/w/en

Page reveal duration

spacing

int

r/w/en

Spacing between pages

Style Properties¶

Inherited:

Gtk.Widget (17)

Signals¶

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1), Handy.Swipeable (1)

Name

Short Description

page-changed

This signal is emitted after a page has been changed.

Fields¶

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1), Handy.Swipeable (1)

Class Details¶

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

Gtk.EventBox, Gtk.Orientable, Handy.Swipeable

Abstract:

No

Structure:

Handy.CarouselClass

A paginated scrolling widget.

The HdyCarousel 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 HdyCarousel.

CSS nodes

HdyCarousel has a single CSS node with name carousel.

New in version 1.0.

classmethod new()¶
Returns:

the newly created HdyCarousel

Return type:

Gtk.Widget

Creates a new HdyCarousel.

New in version 1.0.

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.

New in version 1.2.

get_allow_mouse_drag()¶
Returns:

TRUE if self can be dragged with mouse

Return type:

bool

Sets whether self can be dragged with mouse pointer.

New in version 1.0.

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.

New in version 1.4.

get_animation_duration()¶
Returns:

animation duration, in milliseconds

Return type:

int

Gets animation duration used by [method`Carousel`.scroll_to].

New in version 1.0.

get_interactive()¶
Returns:

TRUE if self can be swiped

Return type:

bool

Gets whether self can be navigated.

New in version 1.0.

get_n_pages()¶
Returns:

the number of pages in self

Return type:

int

Gets the number of pages in self.

New in version 1.0.

get_position()¶
Returns:

the scroll position

Return type:

float

Gets current scroll position in self. It’s unitless, 1 matches 1 page.

New in version 1.0.

get_reveal_duration()¶
Returns:

the duration

Return type:

int

Gets duration of the animation used when adding or removing pages, in milliseconds.

New in version 1.0.

get_spacing()¶
Returns:

spacing between pages

Return type:

int

Gets spacing between pages in pixels.

New in version 1.0.

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

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

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.

New in version 1.0.

prepend(child)¶
Parameters:

child (Gtk.Widget) – a widget to add

Prepends child to self.

New in version 1.0.

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 to the end.

New in version 1.0.

scroll_to(widget)¶
Parameters:

widget (Gtk.Widget) – a child of self

Scrolls to widget position with an animation.

[property`Carousel`:py:data::animation-duration<Handy.Carousel.props.animation_duration>] property can be used for controlling the duration.

New in version 1.0.

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

  • duration (int) – animation duration, in milliseconds

Scrolls to widget position with an animation.

New in version 1.0.

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.

New in version 1.2.

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.

New in version 1.0.

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.

New in version 1.4.

set_animation_duration(duration)¶
Parameters:

duration (int) – animation duration, in milliseconds

Sets animation duration used by [method`Carousel`.scroll_to].

New in version 1.0.

set_interactive(interactive)¶
Parameters:

interactive (bool) – whether self can be swiped

Sets whether self can be navigated.

This can be used to temporarily disable a [class`Carousel`] to only allow swiping in a certain state.

New in version 1.0.

set_reveal_duration(reveal_duration)¶
Parameters:

reveal_duration (int) – the new reveal duration value

Sets duration of the animation used when adding or removing pages, in milliseconds.

New in version 1.0.

set_spacing(spacing)¶
Parameters:

spacing (int) – the new spacing value

Sets spacing between pages in pixels.

New in version 1.0.

Signal Details¶

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

page-changed

Flags:

RUN_LAST

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

  • index (int) – the 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.

New in version 1.0.

Property Details¶

Handy.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.

New in version 1.2.

Handy.Carousel.props.allow_mouse_drag¶
Name:

allow-mouse-drag

Type:

bool

Default Value:

True

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Sets whether the [class`Carousel`] can be dragged with mouse pointer.

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

New in version 1.0.

Handy.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.

New in version 1.4.

Handy.Carousel.props.animation_duration¶
Name:

animation-duration

Type:

int

Default Value:

250

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Animation duration used by [method`Carousel`.scroll_to], in milliseconds.

New in version 1.0.

Handy.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 a HdyCarousel to only allow navigating it in a certain state.

New in version 1.0.

Handy.Carousel.props.n_pages¶
Name:

n-pages

Type:

int

Default Value:

0

Flags:

READABLE, EXPLICIT_NOTIFY

The number of pages in a [class`Carousel`].

New in version 1.0.

Handy.Carousel.props.position¶
Name:

position

Type:

float

Default Value:

0.0

Flags:

READABLE, EXPLICIT_NOTIFY

Current scrolling position, unitless.

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

New in version 1.0.

Handy.Carousel.props.reveal_duration¶
Name:

reveal-duration

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Page reveal duration, in milliseconds.

New in version 1.0.

Handy.Carousel.props.spacing¶
Name:

spacing

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Spacing between pages in pixels.

New in version 1.0.