Gtk.Frame - Classes - Gtk 3.0 (original) (raw)

g Atk.ImplementorIface Atk.ImplementorIface Gtk.Widget Gtk.Widget Atk.ImplementorIface->Gtk.Widget GObject.GInterface GObject.GInterface GObject.GInterface->Atk.ImplementorIface Gtk.Buildable Gtk.Buildable GObject.GInterface->Gtk.Buildable GObject.InitiallyUnowned GObject.InitiallyUnowned GObject.InitiallyUnowned->Gtk.Widget GObject.Object GObject.Object GObject.Object->GObject.InitiallyUnowned Gtk.Bin Gtk.Bin Gtk.Frame Gtk.Frame Gtk.Bin->Gtk.Frame Gtk.Buildable->Gtk.Widget Gtk.Container Gtk.Container Gtk.Container->Gtk.Bin Gtk.Widget->Gtk.Container

Example

../_images/Frame.png

Subclasses:

Gtk.AspectFrame

Methods

Inherited:

Gtk.Bin (1), Gtk.Container (35), Gtk.Widget (278), GObject.Object (37), Gtk.Buildable (10)

Structs:

Gtk.ContainerClass (5), Gtk.WidgetClass (12), GObject.ObjectClass (5)

class new (label)
get_label ()
get_label_align ()
get_label_widget ()
get_shadow_type ()
set_label (label)
set_label_align (xalign, yalign)
set_label_widget (label_widget)
set_shadow_type (type)

Virtual Methods

Inherited:

Gtk.Container (10), Gtk.Widget (82), GObject.Object (7), Gtk.Buildable (10)

do_compute_child_allocation (allocation)

Properties

Inherited:

Gtk.Container (3), Gtk.Widget (39)

Name Type Flags Short Description
label str r/w/en Text of the frame’s label
label-widget Gtk.Widget r/w A widget to display in place of the usual frame label
label-xalign float r/w/en The horizontal alignment of the label
label-yalign float r/w/en The vertical alignment of the label
shadow-type Gtk.ShadowType r/w/en Appearance of the frame border

Style Properties

Inherited:

Gtk.Widget (17)

Signals

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Fields

Inherited:

Gtk.Container (4), Gtk.Widget (69), GObject.Object (1)

Name Type Access Description
bin Gtk.Bin r

Class Details

class Gtk.Frame(**kwargs)

Bases:

Gtk.Bin

Abstract:

No

Structure:

Gtk.FrameClass

The frame widget is a bin that surrounds its child with a decorative frame and an optional label. If present, the label is drawn in a gap in the top side of the frame. The position of the label can be controlled with Gtk.Frame.set_label_align().

Gtk.Frame as Gtk.Buildable

The Gtk.Frame implementation of the Gtk.Buildable interface supports placing a child in the label position by specifying “label” as the “type” attribute of a <child> element. A normal content child can be specified without specifying a <child> type attribute.

An example of a UI definition fragment with GtkFrame :

CSS nodes

frame ├── border[.flat] ├── ╰──

Gtk.Frame has a main CSS node named “frame” and a subnode named “border”. The “border” node is used to draw the visible border. You can set the appearance of the border using CSS properties like “border-style” on the “border” node.

The border node can be given the style class “.flat”, which is used by themes to disable drawing of the border. To do this from code, callGtk.Frame.set_shadow_type() with Gtk.ShadowType.NONE to add the “.flat” class or any other shadow type to remove it.

classmethod new(label)[source]

Parameters:

label (str or None) – the text to use as the label of the frame

Returns:

a new Gtk.Frame widget

Return type:

Gtk.Widget

Creates a new Gtk.Frame, with optional label label. If label is None, the label is omitted.

get_label()[source]

Returns:

the text in the label, or None if there was no label widget or the lable widget was not a Gtk.Label. This string is owned by GTK+ and must not be modified or freed.

Return type:

str or None

If the frame’s label widget is a Gtk.Label, returns the text in the label widget. (The frame will have a Gtk.Labelfor the label widget if a non-None argument was passed to Gtk.Frame.new().)

get_label_align()[source]

Returns:

xalign:

location to store X alignment of frame’s label, or None

yalign:

location to store X alignment of frame’s label, or None

Return type:

(xalign: float, yalign: float)

Retrieves the X and Y alignment of the frame’s label. SeeGtk.Frame.set_label_align().

get_label_widget()[source]

Returns:

the label widget, or None if there is none.

Return type:

Gtk.Widget or None

Retrieves the label widget for the frame. SeeGtk.Frame.set_label_widget().

get_shadow_type()[source]

Returns:

the current shadow type of the frame.

Return type:

Gtk.ShadowType

Retrieves the shadow type of the frame. SeeGtk.Frame.set_shadow_type().

set_label(label)[source]

Parameters:

label (str or None) – the text to use as the label of the frame

Removes the current Gtk.Frame :label-widget. If label is not None, creates a new Gtk.Label with that text and adds it as the Gtk.Frame :label-widget.

set_label_align(xalign, yalign)[source]

Parameters:

Sets the alignment of the frame widget’s label. The default values for a newly created frame are 0.0 and 0.5.

set_label_widget(label_widget)[source]

Parameters:

label_widget (Gtk.Widget or None) – the new label widget

Sets the Gtk.Frame :label-widget for the frame. This is the widget that will appear embedded in the top edge of the frame as a title.

set_shadow_type(type)[source]

Parameters:

type (Gtk.ShadowType) – the new Gtk.ShadowType

Sets the Gtk.Frame :shadow-type for self, i.e. whether it is drawn without (Gtk.ShadowType.NONE) or with (other values) a visible border. Values other thanGtk.ShadowType.NONE are treated identically by Gtk.Frame. The chosen type is applied by removing or adding the .flat class to the CSS node named border.

do_compute_child_allocation(allocation) virtual

Parameters:

allocation (Gdk.Rectangle) –

Property Details

Gtk.Frame.props.label

Name:

label

Type:

str

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Text of the frame’s label

Gtk.Frame.props.label_widget

Name:

label-widget

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE

A widget to display in place of the usual frame label

Gtk.Frame.props.label_xalign

Name:

label-xalign

Type:

float

Default Value:

0.0

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The horizontal alignment of the label

Gtk.Frame.props.label_yalign

Name:

label-yalign

Type:

float

Default Value:

0.5

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The vertical alignment of the label

Gtk.Frame.props.shadow_type

Name:

shadow-type

Type:

Gtk.ShadowType

Default Value:

Gtk.ShadowType.ETCHED_IN

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Appearance of the frame border