Custom Widgets¶
Contents
Summary
An abstract base class that is used to create custom widgets. |
UserWidget¶
- class dearpygui_obj.userwidget.UserWidget(*args: Any, parent: str = 'None', before: Optional[str] = None, **kwargs: Any)[source]¶
Bases:
dearpygui_obj.wrapper.widget.Widget,dearpygui_obj.wrapper.widget.ItemWidgetMx,abc.ABCAn abstract base class that is used to create custom widgets.
This class provides a way to create custom widgets that are composed of other widgets. This can be useful for creating custom complex controls that you want to use like a single widget.
Note that while the user widget is actually a container (it has to be, to hold the user’s custom content), it not meant to be used as a
ContainerWidgetMx. It does not have any of the container widget methods likeContainerWidgetMx.add_child()and cannot be used as a context manager.This makes it ideal for custom controls whose contents are ‘closed’ and not meant to have abitrary additional widgets added to them as children. For custom ‘open’ containers, see
UserContainer(not implemented yet).By default, any positional arguments passed to
__init__()and any keyword arguments that are not reserved byWidgetorItemWidgetMxwill be passed to the__setup_content__()method.This method should be overriden in subclasses to actually create the contents of the custom widget. Furthermore, it is a good practice that subclasses define their own signature for
__setup_widget__()that narrows down the arguments to the ones they actually need.
UserContainer¶
- class dearpygui_obj.userwidget.UserContainer(*args, **kwargs)[source]¶
Bases:
dearpygui_obj.wrapper.widget.Widget,dearpygui_obj.wrapper.widget.ItemWidgetMx,dearpygui_obj.wrapper.widget.ContainerWidgetMx[Any],abc.ABCAn abstract base class that is used to create custom containers.
This class is not yet implemented, as it requires adding to the parent stack which is not yet available in DPG 0.6.