label

Name

label -- A widget which shows a small amount of text.

Synopsis

label [-option value...]

Screenshot

Options

-align

type: a list of the horizontal and vertical alignment or one of topLeft, top, topRight, left, center, right, bottomLeft, bottom, or bottomRight

Alignment of the text.

-data

type: string

User defined data which can be retrieved via the cget subcommand.

-heightGroup

type: string (default: "")

heightGroup can be an arbitrary string. All widgets with the same heightGroup request the same height. If packed with the fill flag set, they will have nevertheless different heights.

-justify

type: ONEOF left, right, center, fill (default: left)

Determines the justification of the text lines. Has no effect if the label has only one line of text.

-maxWidthChars

type: integer

The maximum size of the widget in characters. This option is available since GTK+ 2.6.0

-mnemonicWidget

type: Wiget-ID (default: "")

Widget which is activated for keyboard navigation.

-selectable

type: boolean (default: 0)

Whether the text can be selected.

-sensitive

type: boolean (default: 1)

Whether or not the item is sensitve to user input.

-sizeGroup

type: string (default: "")

sizeGroup can be an arbitrary string. All widgets with the same sizeGroup request the same size. If packed with the fill flag set, they will have nevertheless different sizes.

-text

type: percent-string (default: "")

Text of the label.

-visible

type: boolean (default: 1)

Whether or not the item is visible.

-widthGroup

type: string (default: "")

widthGroup can be an arbitrary string. All widgets with the same widthGroup request the same width. If packed with the fill flag set, they will have nevertheless different widths.

-widthChars

type: integer

Size of the widget in characters. This option is available since GTK+ 2.6.0

-wrap

type: boolean (default: 0)

Whether the text should be automatically wrapped.

-xPad

type: integer (default: 0)

Horizontal padding.

-yPad

type: integer (default: 0)

Vertical padding.

Description

A label displays a small to medium amount of text. With the help of embedded markup commands the text inside a label can even have different fonts, colors etc.

Commands

id cget option

Returns the value for one option. The option may have any of the values accepted by configure.

id configure [-option value...]

Configures the widget. Option may have any of the values accepted on creation of the widget.

id delete

Deletes the widget and the associated tcl command.

Example

set label [gnocl::label -text {%<<span foreground="blue">Hello</span><span foreground="red">World</span>}]
gnocl::window -title "Label" -child $label

results in

See also

text, GtkLabel