Creates a new GtkLabel, containing the text in str. If characters in str are preceded by an underscore, they are underlined. If you need a literal underscore character in a label, use '__' (two underscores). The first underlined character represents a keyboard accelerator called a mnemonic. The mnemonic key can be used to activate another widget, chosen automatically, or explicitly using setMnemonicWidget().

If setMnemonicWidget() is not called, then the first activatable ancestor of the Label will be chosen as the mnemonic widget. For instance, if the label is inside a button or menu item, the button or menu item will automatically become the mnemonic widget and be activated by the mnemonic.

  1. this(GtkLabel* gtkLabel, bool ownedRef)
  2. this(string str, bool mnemonic)
    class Label
    string str
    bool mnemonic = true


str string

The text of the label, with an underscore in front of the mnemonic character

mnemonic bool

when false uses the literal text passed in without mnemonic


ConstructionException GTK+ fails to create the object.