Automatic-GUI#

pyMHF provides a simple way to create GUI elements for your mod.

All components are implemented as decorators which can all be found in pymhf.gui.decorators:

Clickable elements#

gui_button(text: str)#

This decorator is to be applied to a method which takes no arguments. The method will be called when the button is pressed in the gui.

Value elements#

Each of these is applied to a property, however the @property decorator needs to applied later than this decorator (ie. the @property decorator should be on top of this one.) If you forget to add the @property decorator on top of the function, the widget will be rendered in the GUI but it will have the value looking something like the string <Bound method ...>. If the property has a setter then the gui field created will be editable, otherwise it will not be, and for settable properties, changing the entry value will call the setter.

Note that these functions will take any of the extra arguments as listed in the link except the following: tag, source, user_data, callback, use_internal_label. These arguments are reserved by pyMHF for our own purposes and any values provided to the decorator will be ignored/removed.

BOOLEAN(label: str, **kwargs)#

Create a boolean entry field in the form of a checkbox which can take extra arguments. To see what extra arguments are available, see the DearPyGUI documentation here.

INTEGER(label: str, is_slider: bool = False, **kwargs)#

Create an integer entry field which can take extra arguments. To see what extra arguments are available, see the DearPyGUI documentation here. If is_slider is True, a slider will be used to render the widget instead. The allowed extra argument for this case can be found here.

FLOAT(label: str, is_slider: bool = False, **kwargs)#

Create a float entry field which can take extra arguments. Internally this uses double precision when interfacing with DearPyGUI to minimise loss of accuracy. To see what extra arguments are available, see the DearPyGUI documentation here. If is_slider is True, a slider will be used to render the widget instead. The allowed extra argument for this case can be found here.

STRING(label: str, **kwargs)#

Create a string entry field which can take extra arguments. To see what extra arguments are available, see the DearPyGUI documentation here.

ENUM(label: str, **kwargs)#

Create an enum entry field which can take extra arguments. To see what extra arguments are available, see the DearPyGUI documentation here.

Accessing the GUI via code#

In general, you shouldn’t need to access the gui via code within your mod, however, there are a few reasons for doing so (may want more control over what and how things are rendered), but the primary reason is to communicate with the “Hex View” tab.

Every instance of a mod has the pymhf_gui property which is the instance of the pymhf.gui.gui.GUI class which contains all the controls to the GUI.

For more details see Hex View