Gtk.Frame¶
Example¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (181), GObject.Object (37), Gtk.Accessible (15), Gtk.Buildable (1)
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)
|
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/en |
|||
r/w/en |
|||
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gtk.Frame(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
GtkFrame
is a widget that surrounds its child with a decorative frame and an optional label.An example
Gtk.Frame
If present, the label is drawn inside the top edge of the frame. The horizontal position of the label can be controlled with [method`Gtk`.Frame.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.The
GtkFrame
implementation of theGtkBuildable
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
Gtk.Frame
: ``xml <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 theGTK_ACCESSIBLE_ROLE_GROUP
role.- classmethod new(label)[source]¶
- Parameters:
label (
str
orNone
) – the text to use as the label of the frame- Returns:
a new
GtkFrame
widget- Return type:
Creates a new
GtkFrame
, with optional label label.If label is
None
, the label is omitted.
- get_child()[source]¶
- Returns:
the child widget of self
- Return type:
Gtk.Widget
orNone
Gets the child widget of self.
- get_label()[source]¶
- Returns:
the text in the label, or
None
if there was no label widget or the label widget was not aGtkLabel
. This string is owned by GTK and must not be modified or freed.- Return type:
Returns the frame labels text.
If the frame’s label widget is not a
GtkLabel
,None
is returned.
- get_label_align()[source]¶
- Returns:
the frames X alignment
- Return type:
Retrieves the X alignment of the frame’s label.
- get_label_widget()[source]¶
- Returns:
the label widget
- Return type:
Gtk.Widget
orNone
Retrieves the label widget for the frame.
- set_child(child)[source]¶
- Parameters:
child (
Gtk.Widget
orNone
) – the child widget
Sets the child widget of self.
- set_label(label)[source]¶
-
Creates a new
GtkLabel
with the label and sets it as the frame’s label widget.
- set_label_align(xalign)[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.
Sets the X alignment of the frame widget’s label.
The default value for a newly created frame is 0.0.
- set_label_widget(label_widget)[source]¶
- Parameters:
label_widget (
Gtk.Widget
orNone
) – the new label widget
Sets the label widget for the frame.
This is the widget that will appear embedded in the top edge of the frame as a title.
- do_compute_child_allocation(allocation) virtual¶
- Parameters:
allocation (
Gdk.Rectangle
) –
Property Details¶
- Gtk.Frame.props.child¶
- Name:
child
- Type:
- Default Value:
- Flags:
The child widget.
- 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:
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.