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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Gtk.EventBox (2), Gtk.Container (3), Gtk.Widget (39), Gtk.Orientable (1)
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
Whether to allow swiping for more than one page at a time |
||
r/w/en |
Whether to allow dragging with mouse pointer |
||
r/w/en |
Whether the widget will respond to scroll wheel events |
||
r/w/en |
Default animation duration |
||
r/w/en |
Whether the widget can be swiped |
||
r/en |
Number of pages |
||
r/en |
Current scrolling position |
||
r/w/en |
Page reveal duration |
||
r/w/en |
Spacing between pages |
Style Properties¶
- Inherited:
Signals¶
Name |
Short Description |
---|---|
This signal is emitted after a page has been changed. |
Fields¶
Class Details¶
- class Handy.Carousel(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
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 namecarousel
.New in version 1.0.
- classmethod new()¶
- Returns:
the newly created
HdyCarousel
- Return type:
Creates a new
HdyCarousel
.New in version 1.0.
- get_allow_long_swipes()¶
- Returns:
TRUE
if long swipes are allowed- Return type:
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:
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:
Gets whether self will respond to scroll wheel events.
New in version 1.4.
- get_animation_duration()¶
- Returns:
animation duration, in milliseconds
- Return type:
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:
Gets whether self can be navigated.
New in version 1.0.
- get_n_pages()¶
- Returns:
the number of pages in self
- Return type:
Gets the number of pages in self.
New in version 1.0.
- get_position()¶
- Returns:
the scroll position
- Return type:
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:
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:
Gets spacing between pages in pixels.
New in version 1.0.
- insert(child, position)¶
- Parameters:
child (
Gtk.Widget
) – a widget to addposition (
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 addposition (
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 selfduration (
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.
Signal Details¶
- Handy.Carousel.signals.page_changed(carousel, index)¶
- Signal Name:
page-changed
- Flags:
- Parameters:
carousel (
Handy.Carousel
) – The object which received the signalindex (
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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
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:
- Default Value:
- Flags:
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:
- Default Value:
250
- Flags:
Animation duration used by [method`Carousel`.scroll_to], in milliseconds.
New in version 1.0.
- Handy.Carousel.props.interactive¶
- Name:
interactive
- Type:
- Default Value:
- Flags:
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:
- Default Value:
0
- Flags:
The number of pages in a [class`Carousel`].
New in version 1.0.
- Handy.Carousel.props.position¶
- Name:
position
- Type:
- Default Value:
0.0
- Flags:
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:
- Default Value:
0
- Flags:
Page reveal duration, in milliseconds.
New in version 1.0.
- Handy.Carousel.props.spacing¶
- Name:
spacing
- Type:
- Default Value:
0
- Flags:
Spacing between pages in pixels.
New in version 1.0.