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¶
Subclasses:
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:
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:
Abstract:
No
Structure:
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().
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:
Creates a new Gtk.Frame, with optional label label. If label is None, the label is omitted.
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:
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().)
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().
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().
Returns:
the current shadow type of the frame.
Return type:
Retrieves the shadow type of the frame. SeeGtk.Frame.set_shadow_type().
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:
- xalign (float) – The position of the label along the top edge of the widget. A value of 0.0 represents left alignment; 1.0 represents right alignment.
- yalign (float) – The y alignment of the label. A value of 0.0 aligns under the frame; 1.0 aligns above the frame. If the values are exactly 0.0 or 1.0 the gap in the frame won’t be painted because the label will be completely above or below the frame.
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:
Default Value:
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Text of the frame’s label
Gtk.Frame.props.label_widget¶
Name:
label-widget
Type:
Default Value:
Flags:
A widget to display in place of the usual frame label
Gtk.Frame.props.label_xalign¶
Name:
label-xalign
Type:
Default Value:
0.0
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
The horizontal alignment of the label
Gtk.Frame.props.label_yalign¶
Name:
label-yalign
Type:
Default Value:
0.5
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
The vertical alignment of the label
Gtk.Frame.props.shadow_type¶
Name:
shadow-type
Type:
Default Value:
Flags:
READABLE, WRITABLE, EXPLICIT_NOTIFY
Appearance of the frame border