Skip to content

Gtk.CenterLayout

class — extends LayoutManager

Manages up to three children.

The start widget is allocated at the start of the layout (left in left-to-right locales and right in right-to-left ones), and the end widget at the end.

The center widget is centered regarding the full width of the layout's.

Constructors

new

@classmethod
def new(cls) -> LayoutManager

Creates a new GtkCenterLayout.

Methods

get_baseline_position

def get_baseline_position(self) -> BaselinePosition

Returns the baseline position of the layout.

get_center_widget

def get_center_widget(self) -> Widget | None

Returns the center widget of the layout.

get_end_widget

def get_end_widget(self) -> Widget | None

Returns the end widget of the layout.

get_orientation

def get_orientation(self) -> Orientation

Gets the current orienration of the layout manager.

get_shrink_center_last

def get_shrink_center_last(self) -> bool

Gets whether self shrinks the center widget after other children.

get_start_widget

def get_start_widget(self) -> Widget | None

Returns the start widget of the layout.

set_baseline_position

def set_baseline_position(self, baseline_position: BaselinePosition | int) -> None

Sets the new baseline position of self

Parameters:

  • baseline_position — the new baseline position

set_center_widget

def set_center_widget(self, widget: Widget | None = ...) -> None

Sets the new center widget of self.

To remove the existing center widget, pass None.

Parameters:

  • widget — the new center widget

set_end_widget

def set_end_widget(self, widget: Widget | None = ...) -> None

Sets the new end widget of self.

To remove the existing center widget, pass None.

Parameters:

  • widget — the new end widget

set_orientation

def set_orientation(self, orientation: Orientation | int) -> None

Sets the orientation of self.

Parameters:

  • orientation — the new orientation

set_shrink_center_last

def set_shrink_center_last(self, shrink_center_last: bool) -> None

Sets whether to shrink the center widget after other children.

By default, when there's no space to give all three children their natural widths, the start and end widgets start shrinking and the center child keeps natural width until they reach minimum width.

If set to FALSE, start and end widgets keep natural width and the center widget starts shrinking instead.

Parameters:

  • shrink_center_last — whether to shrink the center widget after others

set_start_widget

def set_start_widget(self, widget: Widget | None = ...) -> None

Sets the new start widget of self.

To remove the existing start widget, pass None.

Parameters:

  • widget — the new start widget

Properties

shrink_center_last

shrink_center_last: bool  # read/write

Whether to shrink the center widget after other children.

By default, when there's no space to give all three children their natural widths, the start and end widgets start shrinking and the center child keeps natural width until they reach minimum width.

If set to FALSE, start and end widgets keep natural width and the center widget starts shrinking instead.