GtkLabel

A widget that displays a small to medium amount of text.

Object Hierarchy

GObject
`-- GtkObject
       `-- GtkWidget
              `-- GtkMisc
                     `-- GtkLabel

Direct Subclasses

Description

The GtkLabel widget displays a small amount of text. As the name implies, most labels are used to label another widget such as a GtkButton, a GtkMenuItem, or a GtkOptionMenu.

You can have control over the way a GtkLabel will be displayed with some methods such as set_justify() or set_width_chars() . As a subclass of GtkMisc, you may specify alignment and padding with set_alignment() and set_padding() . However, set_padding() only supports setting padding for the right/left and top/bottom pairs. If you need to specify different values for left and right padding, you can insert the label into a GtkAlignment container.

Constructors

GtkLabel ([string string = null [, boolean parse_mnemonic = false]]);

-- Creates a new GtkLabel.

Methods

get()
  DEPRECATED. Gets the string of the label.
get_angle()
  Gets the angle of rotation for the label.
get_attributes()
  Returns the list of Pango attributes for the label.
get_ellipsize()
  Returns the ellipsization mode is used to shorten the text.
get_justify()
  Returns the justification of the label.
get_label()
  Fetches the text including any embedded underlines indicating mnemonics and Pango markup.
get_layout()
  Gets the PangoLayout used to display the label.
get_layout_offsets()
  Obtains the coordinates where the label will draw the PangoLayout.
get_line_wrap()
  Returns whether lines in the label are automatically wrapped.
get_max_width_chars()
  Returns the maximum width in characters.
get_mnemonic_keyval()
  Returns the keyval of the mnemonic key if set.
get_mnemonic_widget()
  Retrieves the target of the mnemonic (keyboard shortcut) of this label.
get_selectable()
  Checks it the user can select text in the label.
get_selection_bounds()
  Gets the selected range of characters in the label.
get_single_line_mode()
  Returns if the label displays only one line.
get_text()
  Fetches the text from a label widget, as displayed on the screen.
get_use_markup()
  Returns whether the label's text is interpreted as marked up with the Pango text markup language.
get_use_underline()
  Returns whether an embedded underline in the label indicates a mnemonic.
get_width_chars()
  Retrieves the desired width of the label, in characters.
parse_uline()
  DEPRECATED. Parses the given string for underscores and converts the next character to an underlined character.
select_region()
  Selects a range of characters in the label, if the label is selectable.
set()
  DEPRECATED. Alias for set_text() .
set_angle()
  Sets the angle of rotation for the label.
set_attributes()
  Sets a list of Pango attributes for the label.
set_ellipsize()
  Sets the ellipsization mode used to make the text fit the width.
set_justify()
  Sets the alignment of the lines in the text of the label relative to each other.
set_label()
  Sets the text of the label incl. Pango markup.
set_line_wrap()
  Toggles line wrapping within the GtkLabel widget.
set_markup()
  Set the label text with a Pango marked up string.
set_markup_with_mnemonic()
  Set the label text and mnemonic with a Pango marked up string.
set_max_width_chars()
  Sets the desired maximum width in characters.
set_mnemonic_widget()
  Sets the widget that will be activated if the user presses the mnemonic key for the label.
set_pattern()
  The pattern of underlines you want under the existing text within the GtkLabel widget.
set_selectable()
  Sets whether or not the text of the label is selectable.
set_single_line_mode()
  Sets whether the label is in single line mode.
set_text()
  Sets the text within the label.
set_text_with_mnemonic()
  Sets the label's text and parses underscores to a mnemonic.
set_use_markup()
  Sets whether the text of the label contains markup in Pango's text markup language.
set_use_underline()
  If an underline shall be used for the mnemonic accelerator key.
set_width_chars()
  Sets the desired width of the label, in characters.

Properties

Use get_property and set_property methods to access these.

angle:
  The display angle of the text.
attributes:
  A list of Pango attributes applied to the label.
curosr-position:
  The current position of the cursor.
ellipsize:
  The ellipsization mode of the label.
justify:
  The justification mode of the label.
label:
  The text to be shown by the label.
max-width-chars:
  The maximum width of the widget in characters.
mnemonic-keyval:
  The mnemonic accelerator key for this label.
mnemonic-widget:
  The widget to be activated when the label's mnemonic key is pressed.
pattern:
  A string of '_' characters indicating which characters in the label to underline.
selectable:
  Whether or not the text of the label is selectable.
selection-bound:
  The position of the selection bound.
single-line-mode:
  Whether or not the label is in single line mode.
use_markup:
  Whether or not the label should be processed for Pango markup.
use_underline:
  Whether or not the label contains an underline for a mnemonic.
width-chars:
  The width of the widget in characters.
wrap:
  Whether or not a long string of text may wrap to the next line.

Signals

"copy-clipboard"
  Emitted when all or part of the label's text is copied to the clipboard.
"move-cursor"
  Emitted when the cursor is moved within the label.
"populate-popup"
  Emitted when a context menu for the label is popped up.