Core Functionality¶
An object-oriented Wrapper around DearPyGui 0.6
Contents
Summary
Start the GUI engine and show the main window. |
|
Stop the GUI engine and exit the main window. |
|
Get the status of the GUI engine. |
|
Retrieve an item using its unique name. |
|
Retrieve an item using its unique name or |
|
Get the active window. |
|
Iterate all items and yield their wrapper objects. |
|
Iterate all windows and yield their wrapper objects. |
|
Fires when the main window is started. |
|
Fires when the main window is exited. |
|
Fires after rendering each frame. |
|
Create a data value |
|
Proxy object for working with Dear PyGui’s Value Storage System |
|
Wraps callbacks that expect |
|
If the callback was wrapped with |
|
Get the time elapsed since the last frame. |
|
Get the time elapsed since the application started. |
|
Enable or disable vsync |
Start/Stop the GUI Engine¶
Get/Iterate Items¶
- dearpygui_obj.get_item_by_id(widget_id: int) Widget[source]¶
Retrieve an item using its unique name.
If the item was created by instantiating a
Widgetobject, this will return that object. Otherwise, a new wrapper object will be created for that item and returned. Future calls for the same ID will return the same object.- Raises
KeyError – if name refers to an item that is invalid (deleted) or does not exist.
- dearpygui_obj.try_get_item_by_id(widget_id: int) Optional[Widget][source]¶
Retrieve an item using its unique name or
None.Similar to
get_item_by_id(), but returnsNoneif the wrapper object could not be retrieved.
Value Storage System¶
- dearpygui_obj.create_value(init_value: Any) DataValue[source]¶
Create a data value
This can be handy if you need to refer to a value before the widgets that supply the value have been added. For example:
linked_text = create_value('') with Window('Data Example'): ## using created value TextInput('Text1', data_source = linked_text) TextInput('Text2', data_source = linked_text) ## directly assign a widget as data source text3 = TextInput('Text3', data_source = linked_text) TextInput('Text4', data_source = text3)
System-Level Callbacks¶
- dearpygui_obj.set_start_callback(callback: Callable) None[source]¶
Fires when the main window is started.
Callback Helpers¶
- dearpygui_obj.wrap_callback(callback: PyGuiCallback) _DPGCallback[source]¶
Wraps callbacks that expect
senderto be an object.DPG expects callbacks’ sender argument to take the sender ID as a string. However it is convenient to write callbacks where the sender is an object.
This can be used to wrap such callbacks, ensuring that the ID is resolved into an object before the wrapped callback is invoked.
Note
DearPyGui-Obj will typically wrap callbacks for you so this function should only be needed if you are calling DPG functions yourself directly.
- dearpygui_obj.unwrap_callback(callback: Callable) Callable[source]¶
If the callback was wrapped with
wrap_callback(), this will unwrap it.Otherwise, the callback will just be returned unchanged.