Core Functionality

An object-oriented Wrapper around DearPyGui 0.6

Summary

start_gui

Start the GUI engine and show the main window.

stop_gui

Stop the GUI engine and exit the main window.

is_running

Get the status of the GUI engine.

get_item_by_id

Retrieve an item using its unique name.

try_get_item_by_id

Retrieve an item using its unique name or None.

get_active_window

Get the active window.

iter_all_items

Iterate all items and yield their wrapper objects.

iter_all_windows

Iterate all windows and yield their wrapper objects.

set_start_callback

Fires when the main window is started.

set_exit_callback

Fires when the main window is exited.

set_render_callback

Fires after rendering each frame.

create_value

Create a data value

DataValue

Proxy object for working with Dear PyGui’s Value Storage System

wrap_callback

Wraps callbacks that expect sender to be an object.

unwrap_callback

If the callback was wrapped with wrap_callback(), this will unwrap it.

get_delta_time

Get the time elapsed since the last frame.

get_total_time

Get the time elapsed since the application started.

enable_vsync

Enable or disable vsync

Start/Stop the GUI Engine

dearpygui_obj.start_gui(*, primary_window: Window = None) None[source]

Start the GUI engine and show the main window.

dearpygui_obj.stop_gui() None[source]

Stop the GUI engine and exit the main window.

dearpygui_obj.is_running() bool[source]

Get the status of 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 Widget object, 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 returns None if the wrapper object could not be retrieved.

dearpygui_obj.get_active_window() Widget[source]

Get the active window.

dearpygui_obj.iter_all_items() Iterable[Widget][source]

Iterate all items and yield their wrapper objects.

dearpygui_obj.iter_all_windows() Iterable[Widget][source]

Iterate all windows and yield their wrapper objects.

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)
class dearpygui_obj.DataValue(data_source: Any)[source]

Bases: object

Proxy object for working with Dear PyGui’s Value Storage System

id: str
property value: Any

System-Level Callbacks

dearpygui_obj.set_start_callback(callback: Callable) None[source]

Fires when the main window is started.

dearpygui_obj.set_exit_callback(callback: Callable) None[source]

Fires when the main window is exited.

dearpygui_obj.set_render_callback(callback: Callable) None[source]

Fires after rendering each frame.

Callback Helpers

dearpygui_obj.wrap_callback(callback: PyGuiCallback) _DPGCallback[source]

Wraps callbacks that expect sender to 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.

Miscellaneous

dearpygui_obj.get_delta_time() float[source]

Get the time elapsed since the last frame.

dearpygui_obj.get_total_time() float[source]

Get the time elapsed since the application started.

dearpygui_obj.enable_vsync(enabled: bool) None[source]

Enable or disable vsync