Skip to content

Gtk.Revealer

class — extends Widget, Accessible, Buildable, ConstraintTarget

Animates the transition of its child from invisible to visible.

The style of transition can be controlled with Revealer.set_transition_type.

These animations respect the Settings.gtk-enable-animations setting.

CSS nodes

GtkRevealer has a single CSS node with name revealer. When styling GtkRevealer using CSS, remember that it only hides its contents, not itself. That means applied margin, padding and borders will be visible even when the Revealer.reveal-child property is set to False.

Accessibility

GtkRevealer uses the AccessibleRole.group role.

The child of GtkRevealer, if set, is always available in the accessibility tree, regardless of the state of the revealer widget.

Constructors

new

@classmethod
def new(cls) -> Widget

Creates a new GtkRevealer.

Methods

get_child

def get_child(self) -> Widget | None

Gets the child widget of revealer.

get_child_revealed

def get_child_revealed(self) -> bool

Returns whether the child is fully revealed.

In other words, this returns whether the transition to the revealed state is completed.

get_reveal_child

def get_reveal_child(self) -> bool

Returns whether the child is currently revealed.

This function returns True as soon as the transition is to the revealed state is started. To learn whether the child is fully revealed (ie the transition is completed), use Revealer.get_child_revealed.

get_transition_duration

def get_transition_duration(self) -> int

Returns the amount of time (in milliseconds) that transitions will take.

get_transition_type

def get_transition_type(self) -> RevealerTransitionType

Gets the type of animation that will be used for transitions in revealer.

set_child

def set_child(self, child: Widget | None = ...) -> None

Sets the child widget of revealer.

Parameters:

  • child — the child widget

set_reveal_child

def set_reveal_child(self, reveal_child: bool) -> None

Tells the GtkRevealer to reveal or conceal its child.

The transition will be animated with the current transition type of revealer.

Parameters:

  • reveal_childTrue to reveal the child

set_transition_duration

def set_transition_duration(self, duration: int) -> None

Sets the duration that transitions will take.

Parameters:

  • duration — the new duration, in milliseconds

set_transition_type

def set_transition_type(self, transition: RevealerTransitionType | int) -> None

Sets the type of animation that will be used for transitions in revealer.

Available types include various kinds of fades and slides.

Parameters:

  • transition — the new transition type

Properties

child

child: Widget  # read/write

The child widget.

child_revealed

child_revealed: bool  # read-only

Whether the child is revealed and the animation target reached.

reveal_child

reveal_child: bool  # read/write

Whether the revealer should reveal the child.

transition_duration

transition_duration: int  # read/write

The animation duration, in milliseconds.

transition_type

transition_type: RevealerTransitionType | int  # read/write

The type of animation used to transition.