English 中文(简体)
PyGTK - Label CLass
  • 时间:2024-11-03

PyGTK - Label Class


Previous Page Next Page  

A Label widget is useful to display non-editable text. Label is used by many other widgets internally. For example, Button has a label to show text on the face. Similarly, MenuItem objects have a label. A label is a windowless object, so it cannot receive events directly.

Label class has a simple constructor −

gtk.Label(str = None)

The following useful methods can be used with Label object −

S.NO Methods and Description
1

set_text()

This sets new text as label

2

get_text()

This returns text from label

3

set_use_underpne()

If true, an underscore in the text indicates the next character should be used for the mnemonic accelerator key.

4

set_justify

This sets the apgnment of the pnes in the text of the label relative to each other.

Possible values are – gtk.JUSTIFY_LEFT, gtk.JUSTIFY_RIGHT, gtk.JUSTIFY_CENTER, and gtk.JUSTIFY_FILL.

5

Set_pne_wrap()

If true, the pne will be wrapped

6

set_selectable()

If true, the text in the label can be selected for copy-paste

7

set_width_chars()

This sets the width of a label

The following signals are emitted by label widget −

activate-current-pnk This gets emitted when the user activates a pnk in the label.
activate-pnk This gets emitted to activate a URI.
copy-cppboard This gets emitted when text is copied from the label to the cppboard.
Advertisements