Skip to content

Gtk.Statusbar

class — extends Widget, Accessible, Buildable, ConstraintTarget

:::warning Deprecated since 4.10 This API is deprecated. :::

A GtkStatusbar widget is usually placed along the bottom of an application's main Window.

<picture> <source srcset="statusbar-dark.png" media="(prefers-color-scheme: dark)"> <img alt="An example GtkStatusbar" src="statusbar.png"> </picture>

A GtkStatusBar may provide a regular commentary of the application's status (as is usually the case in a web browser, for example), or may be used to simply output a message when the status changes, (when an upload is complete in an FTP client, for example).

Status bars in GTK maintain a stack of messages. The message at the top of the each bar’s stack is the one that will currently be displayed.

Any messages added to a statusbar’s stack must specify a context id that is used to uniquely identify the source of a message. This context id can be generated by Statusbar.get_context_id, given a message and the statusbar that it will be added to. Note that messages are stored in a stack, and when choosing which message to display, the stack structure is adhered to, regardless of the context identifier of a message.

One could say that a statusbar maintains one stack of messages for display purposes, but allows multiple message producers to maintain sub-stacks of the messages they produced (via context ids).

Status bars are created using Statusbar.new.

Messages are added to the bar’s stack with Statusbar.push.

The message at the top of the stack can be removed using Statusbar.pop. A message can be removed from anywhere in the stack if its message id was recorded at the time it was added. This is done using Statusbar.remove.

CSS node

GtkStatusbar has a single CSS node with name statusbar.

Constructors

new

@classmethod
def new(cls) -> Widget

:::warning Deprecated since 4.10 This API is deprecated. :::

Creates a new GtkStatusbar ready for messages.

Methods

get_context_id

def get_context_id(self, context_description: str) -> int

:::warning Deprecated since 4.10 This API is deprecated. :::

Returns a new context identifier, given a description of the actual context.

Note that the description is not shown in the UI.

Parameters:

  • context_description — textual description of what context the new message is being used in

pop

def pop(self, context_id: int) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

Removes the first message in the GtkStatusbar’s stack with the given context id.

Note that this may not change the displayed message, if the message at the top of the stack has a different context id.

Parameters:

  • context_id — a context identifier

push

def push(self, context_id: int, text: str) -> int

:::warning Deprecated since 4.10 This API is deprecated. :::

Pushes a new message onto a statusbar’s stack.

Parameters:

  • context_id — the message’s context id, as returned by Statusbar.get_context_id
  • text — the message to add to the statusbar

remove

def remove(self, context_id: int, message_id: int) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

Forces the removal of a message from a statusbar’s stack. The exact context_id and message_id must be specified.

Parameters:

  • context_id — a context identifier
  • message_id — a message identifier, as returned by Statusbar.push

remove_all

def remove_all(self, context_id: int) -> None

:::warning Deprecated since 4.10 This API is deprecated. :::

Forces the removal of all messages from a statusbar's stack with the exact context_id.

Parameters:

  • context_id — a context identifier

Signals

text-popped

def on_text_popped(self, context_id: int, text: str) -> None: ...

:::warning Deprecated since 4.10 This API is deprecated. :::

Emitted whenever a new message is popped off a statusbar's stack.

text-pushed

def on_text_pushed(self, context_id: int, text: str) -> None: ...

:::warning Deprecated since 4.10 This API is deprecated. :::

Emitted whenever a new message gets pushed onto a statusbar's stack.