enaml.widgets.raw_widget

Classes

RawWidget

A raw toolkit-specific control.

class enaml.widgets.raw_widget.RawWidget(parent=None, **kwargs)[source]

Bases: Control

A raw toolkit-specific control.

Use this widget when the toolkit backend for the application is known ahead of time, and Enaml does provide an implementation of the required widget. This can be used as a hook to inject custom widgets into an Enaml widget hierarchy.

Notes

When using the Qt backend, note that PySide requires weakrefs for using bound methods as slots. PyQt doesn’t, but executes unsafe code if not using weakrefs. So you should add the following line to your class. __slots__ = (‘__weakref__’,) or pass the keyword argument enable_weakrefs=True to the metaclass:

class MyWidget(RawWidget, enable_weakref=True):
    pass
proxy

A reference to the proxy Control object.

create_widget(parent)[source]

Create the toolkit widget for the control.

This method should create and initialize the widget.

Parameters:

parent (toolkit widget or None) – The parent toolkit widget for the control.

Returns:

result – The toolkit specific widget for the control.

Return type:

toolkit widget

get_widget()[source]

Retrieve the toolkit widget for the control.

Returns:

result – The toolkit widget that was previously created by the call to ‘create_widget’ or None if the proxy is not active or the widget has been destroyed.

Return type:

toolkit widget or None

activated

An event fired when an object’s proxy is activated. It is triggered once during the object lifetime, at the end of the activate_proxy method.

background

The background color of the widget.

destroyed

An event fired when an object has been destroyed. It is triggered once during the object lifetime, just before the object is removed from the tree structure.

enabled

Whether or not the widget is enabled.

initialized

An event fired when an object is initialized. It is triggered once during the object lifetime, at the end of the initialize method.

name

Export the ‘name’ attribute as a declarative member.

style_class

The style class to which this item belongs. Multiple classes can be separated with whitespace. An empty string indicates the widget does not belong to any style class.