Gtk.Inscription

g GObject.GInterface GObject.GInterface Gtk.Accessible Gtk.Accessible GObject.GInterface->Gtk.Accessible Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable Gtk.ConstraintTarget Gtk.ConstraintTarget GObject.GInterface->Gtk.ConstraintTarget GObject.InitiallyUnowned GObject.InitiallyUnowned Gtk.Widget Gtk.Widget GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Accessible->Gtk.Widget Gtk.Buildable->Gtk.Widget Gtk.ConstraintTarget->Gtk.Widget Gtk.Inscription Gtk.Inscription Gtk.Widget->Gtk.Inscription

Subclasses:

None

Methods

Inherited:

Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)

Structs:

Gtk.WidgetClass (18), GObject.ObjectClass (5)

class

new (text)

get_attributes ()

get_min_chars ()

get_min_lines ()

get_nat_chars ()

get_nat_lines ()

get_text ()

get_text_overflow ()

get_wrap_mode ()

get_xalign ()

get_yalign ()

set_attributes (attrs)

set_markup (markup)

set_min_chars (min_chars)

set_min_lines (min_lines)

set_nat_chars (nat_chars)

set_nat_lines (nat_lines)

set_text (text)

set_text_overflow (overflow)

set_wrap_mode (wrap_mode)

set_xalign (xalign)

set_yalign (yalign)

Virtual Methods

Inherited:

Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)

Properties

Inherited:

Gtk.Widget (34), Gtk.Accessible (1)

Name

Type

Flags

Short Description

attributes

Pango.AttrList

r/w/en

markup

str

w/en

min-chars

int

r/w/en

min-lines

int

r/w/en

nat-chars

int

r/w/en

nat-lines

int

r/w/en

text

str

r/w/en

text-overflow

Gtk.InscriptionOverflow

r/w/en

wrap-mode

Pango.WrapMode

r/w/en

xalign

float

r/w/en

yalign

float

r/w/en

Signals

Inherited:

Gtk.Widget (13), GObject.Object (1)

Fields

Inherited:

Gtk.Widget (13), GObject.Object (1)

Class Details

class Gtk.Inscription(**kwargs)
Bases:

Gtk.Widget

Abstract:

No

Structure:

Gtk.InscriptionClass

GtkInscription is a widget to show text in a predefined area.

You likely want to use GtkLabel instead as this widget is intended only for a small subset of use cases. The main scenario envisaged is inside lists such as GtkColumnView.

While a GtkLabel sizes itself depending on the text that is displayed, GtkInscription is given a size and inscribes the given text into that space as well as it can.

Users of this widget should take care to plan behaviour for the common case where the text doesn’t fit exactly in the allocated space.

New in version 4.8.

classmethod new(text)[source]
Parameters:

text (str or None) – The text to display.

Returns:

a new GtkInscription

Return type:

Gtk.Widget

Creates a new GtkInscription with the given text.

New in version 4.8.

get_attributes()[source]
Returns:

the attribute list

Return type:

Pango.AttrList or None

Gets the inscription’s attribute list.

New in version 4.8.

get_min_chars()[source]
Returns:

the min-chars property

Return type:

int

Gets the min-chars of the inscription.

See the [property`Gtk`.Inscription:min-chars] property.

New in version 4.8.

get_min_lines()[source]
Returns:

the min-lines property

Return type:

int

Gets the min-lines of the inscription.

See the [property`Gtk`.Inscription:min-lines] property.

New in version 4.8.

get_nat_chars()[source]
Returns:

the nat-chars property

Return type:

int

Gets the nat-chars of the inscription.

See the [property`Gtk`.Inscription:nat-chars] property.

New in version 4.8.

get_nat_lines()[source]
Returns:

the nat-lines property

Return type:

int

Gets the nat-lines of the inscription.

See the [property`Gtk`.Inscription:nat-lines] property.

New in version 4.8.

get_text()[source]
Returns:

The displayed text

Return type:

str or None

Gets the text that is displayed.

New in version 4.8.

get_text_overflow()[source]
Returns:

the overflow method

Return type:

Gtk.InscriptionOverflow

Gets the inscription’s overflow method.

New in version 4.8.

get_wrap_mode()[source]
Returns:

the line wrap mode

Return type:

Pango.WrapMode

Returns line wrap mode used by the inscription.

See [method`Gtk`.Inscription.set_wrap_mode].

New in version 4.8.

get_xalign()[source]
Returns:

the xalign property

Return type:

float

Gets the xalign of the inscription.

See the [property`Gtk`.Inscription:xalign] property.

New in version 4.8.

get_yalign()[source]
Returns:

the yalign property

Return type:

float

Gets the yalign of the inscription.

See the [property`Gtk`.Inscription:yalign] property.

New in version 4.8.

set_attributes(attrs)[source]
Parameters:

attrs (Pango.AttrList or None) – a [struct`Pango`.AttrList]

Apply attributes to the inscription text.

These attributes will not be evaluated for sizing the inscription.

New in version 4.8.

set_markup(markup)[source]
Parameters:

markup (str or None) – The markup to display

Utility function to set the text and attributes to be displayed.

See the [property`Gtk`.Inscription:markup] property.

New in version 4.8.

set_min_chars(min_chars)[source]
Parameters:

min_chars (int) – the minimum number of characters that should fit, approximately

Sets the min-chars of the inscription.

See the [property`Gtk`.Inscription:min-chars] property.

New in version 4.8.

set_min_lines(min_lines)[source]
Parameters:

min_lines (int) – the minimum number of lines that should fit, approximately

Sets the min-lines of the inscription.

See the [property`Gtk`.Inscription:min-lines] property.

New in version 4.8.

set_nat_chars(nat_chars)[source]
Parameters:

nat_chars (int) – the number of characters that should ideally fit, approximately

Sets the nat-chars of the inscription.

See the [property`Gtk`.Inscription:nat-chars] property.

New in version 4.8.

set_nat_lines(nat_lines)[source]
Parameters:

nat_lines (int) – the number of lines that should ideally fit

Sets the nat-lines of the inscription.

See the [property`Gtk`.Inscription:nat-lines] property.

New in version 4.8.

set_text(text)[source]
Parameters:

text (str or None) – The text to display

Sets the text to be displayed.

New in version 4.8.

set_text_overflow(overflow)[source]
Parameters:

overflow (Gtk.InscriptionOverflow) – the overflow method to use

Sets what to do when the text doesn’t fit.

New in version 4.8.

set_wrap_mode(wrap_mode)[source]
Parameters:

wrap_mode (Pango.WrapMode) – the line wrapping mode

Controls how line wrapping is done.

New in version 4.8.

set_xalign(xalign)[source]
Parameters:

xalign (float) – the new xalign value, between 0 and 1

Sets the xalign of the inscription.

See the [property`Gtk`.Inscription:xalign] property.

New in version 4.8.

set_yalign(yalign)[source]
Parameters:

yalign (float) – the new yalign value, between 0 and 1

Sets the yalign of the inscription.

See the [property`Gtk`.Inscription:yalign] property.

New in version 4.8.

Property Details

Gtk.Inscription.props.attributes
Name:

attributes

Type:

Pango.AttrList

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

A list of style attributes to apply to the text of the inscription.

New in version 4.8.

Gtk.Inscription.props.markup
Name:

markup

Type:

str

Default Value:

None

Flags:

WRITABLE, EXPLICIT_NOTIFY

Utility property that sets both the [property`Gtk`.Inscription:text] and [property`Gtk`.Inscription:attributes] properties, mainly intended for use in Gtk.Builder ui files to ease translation support and bindings.

This function uses [func`Pango`.parse_markup] to parse the markup into text and attributes. The markup must be valid. If you cannot ensure that, consider using [func`Pango`.parse_markup] and setting the two properties yourself.

New in version 4.8.

Gtk.Inscription.props.min_chars
Name:

min-chars

Type:

int

Default Value:

3

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The number of characters that should fit into the inscription at minimum.

This influences the requested width, not the width actually given to the widget, which might turn out to be larger.

Note that this is an approximate character width, so some characters might be wider and some might be thinner, so do not expect the number of characters to exactly match.

If you set this property to 0, the inscription will not request any width at all and its width will be determined entirely by its surroundings.

New in version 4.8.

Gtk.Inscription.props.min_lines
Name:

min-lines

Type:

int

Default Value:

1

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The number of lines that should fit into the inscription at minimum.

This influences the requested height, not the height actually given to the widget, which might turn out to be larger.

Note that this is an approximate line height, so if the text uses things like fancy Unicode or attribute that influence the height, the text might not fit.

If you set this property to 0, the inscription will not request any height at all and its height will be determined entirely by its surroundings.

New in version 4.8.

Gtk.Inscription.props.nat_chars
Name:

nat-chars

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The number of characters that should ideally fit into the inscription.

This influences the requested width, not the width actually given to the widget. The widget might turn out larger as well as smaller.

If this property is set to a value smaller than [property`Gtk`.Inscription:min-chars], that value will be used. In particular, for the default value of 0, this will always be the case.

New in version 4.8.

Gtk.Inscription.props.nat_lines
Name:

nat-lines

Type:

int

Default Value:

0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The number of lines that should ideally fit into the inscription.

This influences the requested height, not the height actually given to the widget. The widget might turn out larger as well as smaller.

If this property is set to a value smaller than [property`Gtk`.Inscription:min-lines], that value will be used. In particular, for the default value of 0, this will always be the case.

New in version 4.8.

Gtk.Inscription.props.text
Name:

text

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The displayed text.

New in version 4.8.

Gtk.Inscription.props.text_overflow
Name:

text-overflow

Type:

Gtk.InscriptionOverflow

Default Value:

Gtk.InscriptionOverflow.CLIP

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The overflow method to use for the text.

New in version 4.8.

Gtk.Inscription.props.wrap_mode
Name:

wrap-mode

Type:

Pango.WrapMode

Default Value:

Pango.WrapMode.WORD_CHAR

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Controls how the line wrapping is done.

Note that unlike GtkLabel, the default here is Pango.WrapMode.WORD_CHAR.

New in version 4.8.

Gtk.Inscription.props.xalign
Name:

xalign

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The horizontal alignment of the text inside the allocated size.

Compare this to [property`Gtk`.Widget:halign], which determines how the inscription’s size allocation is positioned in the available space.

New in version 4.8.

Gtk.Inscription.props.yalign
Name:

yalign

Type:

float

Default Value:

0.5

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The vertical alignment of the text inside the allocated size.

Compare this to [property`Gtk`.Widget:valign], which determines how the inscription’s size allocation is positioned in the available space.

New in version 4.8.