Widget.initTemplate
void initTemplate()Creates and initializes child widgets defined in templates.
This function must be called in the instance initializer for any class which assigned itself a template using [gtk.widget_class.WidgetClass.setTemplate].
It is important to call this function in the instance initializer of a [gtk.widget.Widget] subclass and not in GObject.constructed() or GObject.constructor() for two reasons:
- derived widgets will assume that the composite widgets
defined by its parent classes have been created in their relative instance initializers
- when calling
[gobject.object.ObjectWrap.new_]on a widget with composite templates,
it’s important to build the composite widgets before the construct properties are set. Properties passed to [gobject.object.ObjectWrap.new_] should take precedence over properties set in the private template XML
A good rule of thumb is to call this function as the first thing in an instance initialization function.