PyGTK Statusbar Class - PyGTK

What is PyGTK Statusbar Class?

A statement area, typically at the bottom of a window is called the status bar. Any type of status alteration message can be shown on the status bar. It too has a grip using which it can be resized.

The gtk.Statusbar widget upholds a stack of messages. Therefore, new message gets shown on top of the current message. If it is popped, previous message will be visible again. Basis of the message must be identified by context_id to identify it uniquely.

The resulting is the constructor of the gtk.Statusbar widget –

The resulting are the methods of the gtk.Statusbar class −

  • Statusbar.push(context_id, text) − This pushes a new message onto a statusbar's stack.
  • Statusbar.pop(context_id) − This removes the top message with the specified context_id from the statusbar's stack.

The resulting signals are emitted by the Statusbar widget −

text-popped

This is emitted when a message is removed from the statusbar message stack.

text-pushed

This is emitted when a message is added to the statusbar message stack.

The resulting instance shows the functioning of Statusbar. Toplevel window contains a VBox with two rows. Upper row has a Fixed widget in which a label, an Entry widget and a button is put. Whereas, in the bottom row, a gtk.Statusbar widget is added.

In order to send message to status bar, its context_id needs to be fetched.

The 'clicked' signal of the Button object is linked to a callback function through which a message is pushed in the status bar. And, the 'activate' signal is emitted when Enter key is pressed inside the Entry widget. This widget is connected to another callback.

Both callbacks use push() method to flash the message in the notification area.

Example

Observe the resulting code –

Upon execution, the above code will show the resulting output –
statusbar_demo

Try typing in the text box and press Enter to see the 'text entered' message in status bar.

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

PyGTK Topics