Gtk.Frame¶
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 |
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
Text of the frame’s label |
||
r/w |
A widget to display in place of the usual frame label |
||
r/w/en |
The horizontal alignment of the label |
||
r/w/en |
The vertical alignment of the label |
||
r/w/en |
Appearance of the frame border |
Style Properties¶
- Inherited:
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
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 theGtk.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
:<object class="GtkFrame"> <child type="label"> <object class="GtkLabel" id="frame-label"/> </child> <child> <object class="GtkEntry" id="frame-content"/> </child> </object>
- CSS nodes
frame ├── border[.flat] ├── <label widget> ╰── <child>
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, call
Gtk.Frame.set_shadow_type
() withGtk.ShadowType.NONE
to add the “.flat” class or any other shadow type to remove it.- classmethod new(label)[source]¶
- Parameters:
label (
str
orNone
) – 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 isNone
, 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 aGtk.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 aGtk.Label
for the label widget if a non-None
argument was passed toGtk.Frame.new
().)
- get_label_align()[source]¶
- Returns:
- Return type:
Retrieves the X and Y alignment of the frame’s label. See
Gtk.Frame.set_label_align
().
- get_label_widget()[source]¶
- Returns:
the label widget, or
None
if there is none.- Return type:
Gtk.Widget
orNone
Retrieves the label widget for the frame. See
Gtk.Frame.set_label_widget
().
- get_shadow_type()[source]¶
- Returns:
the current shadow type of the frame.
- Return type:
Retrieves the shadow type of the frame. See
Gtk.Frame.set_shadow_type
().
- set_label(label)[source]¶
-
Removes the current
Gtk.Frame
:label-widget
. If label is notNone
, creates a newGtk.Label
with that text and adds it as theGtk.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
orNone
) – 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 newGtk.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 byGtk.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:
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:
The horizontal alignment of the label
- Gtk.Frame.props.label_yalign¶
- Name:
label-yalign
- Type:
- Default Value:
0.5
- Flags:
The vertical alignment of the label
- Gtk.Frame.props.shadow_type¶
- Name:
shadow-type
- Type:
- Default Value:
- Flags:
Appearance of the frame border