Frame
Superclasses: Widget
, InitiallyUnowned
, Object
Implemented Interfaces: Accessible
, Buildable
, ConstraintTarget
GtkFrame
is a widget that surrounds its child with a decorative
frame and an optional label.
If present, the label is drawn inside the top edge of the frame.
The horizontal position of the label can be controlled with
set_label_align
.
GtkFrame
clips its child. You can use this to add rounded corners
to widgets, but be aware that it also cuts off shadows.
GtkFrame as GtkBuildable
The GtkFrame
implementation of the GtkBuildable
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
├── <label widget>
╰── <child>
GtkFrame
has a main CSS node with name “frame”, which is used to draw the
visible border. You can set the appearance of the border using CSS properties
like “border-style” on this node.
Accessibility
GtkFrame
uses the GTK_ACCESSIBLE_ROLE_GROUP
role.
Constructors
Methods
- class Frame
-
- get_label() str | None
Returns the frame labels text.
If the frame’s label widget is not a
GtkLabel
,None
is returned.
- set_child(child: Widget | None = None) None
Sets the child widget of
frame
.- Parameters:
child – the child widget
- set_label(label: str | None = None) None
Creates a new
GtkLabel
with thelabel
and sets it as the frame’s label widget.- Parameters:
label – the text to use as the label of the frame
Properties
Virtual Methods
Fields
- class Frame
- parent_instance