QNodeEditor.entries.value_box.ValueBoxEntry#
- class QNodeEditor.entries.value_box.ValueBoxEntry(name: str, entry_type: int = 1, value: int = 0, minimum: int = -100, maximum: int = 100, value_type: ~typing.Type[int] = <class 'float'>, theme: ~typing.Type[~QNodeEditor.themes.theme.Theme] = <class 'QNodeEditor.themes.dark.DarkTheme'>, **kwargs)#
Bases:
EntryEntry housing a value box with a value and name
The value box is a number (float or integer) input. The user can drag their mouse to change the value, or click on the box to enter a custom input manually. The value box can have a minimum and/or maximum value.
Examples
entry = ValueBoxEntry('Some entry', value=5, minimum=0, maximum=10, value_type=int) node = MyNode() node.add_entry(entry)
The
Nodeclass also contains helper methods to create value box entries:node = MyNode() node.add_value_entry('Some entry', Entry.TYPE_INPUT, value=5) node.add_value_input('Some input', value=10.0, minimum=0.0) node.add_value_output('Some output', value=15)
Note that the default value type is
int.Properties
Methods
Create a new value box entry.
Hide/show the value box depending on input connections.
Load the value, minimum, and maximum of the value box from an entry state.
Save the value, minimum, and maximum of the value box in the entry state.
- __init__(name: str, entry_type: int = 1, value: int = 0, minimum: int = -100, maximum: int = 100, value_type: ~typing.Type[int] = <class 'float'>, theme: ~typing.Type[~QNodeEditor.themes.theme.Theme] = <class 'QNodeEditor.themes.dark.DarkTheme'>, **kwargs)#
Create a new value box entry.
- Parameters:
name (str) – Name of the entry
entry_type (int) – The type of the entry (
TYPE_STATIC,TYPE_INPUT, orTYPE_OUTPUT)value (int or float) – Initial value of the entry
minimum (int or float) – Minimum value of the entry
maximum (int or float) – Maximum value of the entry
value_type (Type[int] or Type[float]) – Type of value of the entry (
intorfloat)theme (Type[
Theme], optional) – Theme for the entry (default:DarkTheme)
- check_visible() None#
Hide/show the value box depending on input connections.
If the entry is an input and an edge is connected, hide the value box and only show a label. Otherwise, show the value box.
- Return type:
None
- load(state: dict) bool#
Load the value, minimum, and maximum of the value box from an entry state.
- Parameters:
state (dict) – Entry state
- Returns:
Whether setting state succeeded
- Return type:
bool
- save() dict#
Save the value, minimum, and maximum of the value box in the entry state.
- Returns:
State of the value box
- Return type:
dict