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|
This sets new text as label
This returns text from label
If true, an underscore in the text indicates the next character should be used for the mnemonic accelerator key.
This sets the alignment of the lines 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.
If true, the line will be wrapped
If true, the text in the label can be selected for copy-paste
This sets the width of a label
The following signals are emitted by label widget −
|activate-current-link||This gets emitted when the user activates a link in the label.|
|activate-link||This gets emitted to activate a URI.|
|copy-clipboard||This gets emitted when text is copied from the label to the clipboard.|