pymhf.gui.widgets module#

class pymhf.gui.widgets.BoolVariable(id_: str, label: str, mod: Mod, variable_name: str, has_setter: bool = False, extra_args: dict | None = None)#

Bases: Variable

widget_behaviour: WidgetBehaviour = 0#
class pymhf.gui.widgets.Button(id_: str, label: str, callback: GUIElementProtocol)#

Bases: Widget

draw()#

This is the main draw command which will be called once when the widget it to be drawn for the first time. This should create any DearPyGUI widgets which are to be drawn as part of this, as well as creating any variables and binding any callbacks.

reload(mod: Mod, new_widget: GUIElementProtocol[ButtonWidgetData])#
widget_behaviour: WidgetBehaviour = 0#
class pymhf.gui.widgets.CustomWidget(id_: str | None = None)#

Bases: Widget, ABC

has_setter: bool#
is_property: bool#
mod: Mod#
abstractmethod redraw(*args: Any, **kwargs: Any) dict[str, Any] | None#

Redraw the widget. This will be called each frame. This method is guaranteed not to be called before the original draw method. This method can be defined with any number of arguments but the function decorated by this class MUST return a dict which doesn’t contain any keys which aren’t function arguments. If this decorated a property which also has a setter, the returned dictionary (if any) is passed into that setter by value (ie. it’s not spread out - the values must be unpacked from the dictionary inside the setter).

reload(mod: Mod, new_widget: GUIElementProtocol[CustomWidgetData])#
variable_name: str#
widget_behaviour = -1#
class pymhf.gui.widgets.EnumVariable(id_: str, label: str, mod: Mod, variable_name: str, enum: Type[Enum], has_setter: bool = False, extra_args: dict | None = None)#

Bases: Variable

update_variable(_, app_data, user_data)#
widget_behaviour: WidgetBehaviour = 0#
class pymhf.gui.widgets.FloatVariable(id_: str, label: str, mod: Mod, variable_name: str, has_setter: bool = False, is_slider: bool = False, extra_args: dict | None = None)#

Bases: Variable

widget_behaviour: WidgetBehaviour = 0#
class pymhf.gui.widgets.Group(id_: str, label: str | None, child_widgets: list[Widget] | None)#

Bases: Widget

draw(widget_mapping: dict[str, Widget])#

This is the main draw command which will be called once when the widget it to be drawn for the first time. This should create any DearPyGUI widgets which are to be drawn as part of this, as well as creating any variables and binding any callbacks.

reload(mod: Mod, new_widget: GroupWidgetData, new_sub_config: dict[str, list[dict]], gui: GUI)#
remove()#
widget_behaviour: WidgetBehaviour = 1#
class pymhf.gui.widgets.IntVariable(id_: str, label: str, mod: Mod, variable_name: str, has_setter: bool = False, is_slider: bool = False, extra_args: dict | None = None)#

Bases: Variable

widget_behaviour: WidgetBehaviour = 0#
class pymhf.gui.widgets.StringVariable(id_: str, label: str, mod: Mod, variable_name: str, has_setter: bool = False, extra_args: dict | None = None)#

Bases: Variable

widget_behaviour: WidgetBehaviour = 0#
class pymhf.gui.widgets.Variable(id_: str, label: str, mod: Mod, variable_name: str, variable_type: VariableType = VariableType.NONE, has_setter: bool = False, extra_args: dict | None = None)#

Bases: Widget

draw()#

This is the main draw command which will be called once when the widget it to be drawn for the first time. This should create any DearPyGUI widgets which are to be drawn as part of this, as well as creating any variables and binding any callbacks.

reload(mod: Mod, new_widget: GUIElementProtocol[VariableWidgetData])#
remove()#
update_variable(_, app_data, user_data)#
widget_behaviour: WidgetBehaviour = 0#
class pymhf.gui.widgets.Widget(id_: str)#

Bases: ABC

classmethod create(func: GUIElementProtocol[WidgetData] | GroupWidgetData, widget_mapping: dict[str, Widget])#
abstractmethod draw()#

This is the main draw command which will be called once when the widget it to be drawn for the first time. This should create any DearPyGUI widgets which are to be drawn as part of this, as well as creating any variables and binding any callbacks.

handle_widget_behaviour(widget_mapping: dict[str, Widget], surrounding_widgets: WidgetSurrounds | None = None)#

Based on the widget behaviour, clean up from the previous widgets, or attach to them, and then retrn some (optional) extra information which may be required later.

ids: dict[str, int | str]#
abstractmethod reload(mod: Mod, new_widget: GUIElementProtocol[WidgetData])#
remove()#
widget_behaviour: WidgetBehaviour#
class pymhf.gui.widgets.WidgetBehaviour(*values)#

Bases: Enum

CONTINUOUS = 0#
SEPARATE = 1#
UNDEFINED = -1#
class pymhf.gui.widgets.WidgetSurrounds#

Bases: TypedDict

Simple container for info about the surrounding widgets.

after: str | None#
before: str | None#
parent: str | None#