GtkLabel
A widget that displays a small to medium amount of text.
Object Hierarchy
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.