DearPyGui is a modern, fast and powerful GUI framework for Python that provides an easy-to-use, dynamic, GPU-accelerated, cross-platform graphical user interface toolkit.
—
Specialized functionality including node editors, theming, resource management, file dialogs, and developer tools. These features provide advanced capabilities for complex applications and professional development workflows.
def add_node_editor(*, tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a node-based visual programming interface."""
def add_node(*, label: str = '', tag: Union[int, str] = '', pos: Union[List[int], Tuple[int, ...]] = '', **kwargs) -> Union[int, str]:
"""Adds a node to the node editor."""
def add_node_attribute(*, label: str = '', attribute_type: int = '', shape: int = '', tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Adds an input/output attribute to a node."""
def add_node_link(attr_1: Union[int, str], attr_2: Union[int, str], *, tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a connection between node attributes."""def add_theme(*, tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a theme for styling UI elements."""
def add_theme_color(item: int, color: Union[List[int], Tuple[int, ...]], *, category: int = '', tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Adds a color override to a theme."""
def add_theme_style(item: int, x: float, y: float = '', *, category: int = '', tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Adds a style override to a theme."""
def add_theme_component(item: int, *, enabled_state: bool = '', tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Adds a theme component for specific item types."""
def bind_theme(theme: Union[int, str]) -> None:
"""Applies a theme globally."""
def bind_item_theme(item: Union[int, str], theme: Union[int, str]) -> None:
"""Applies a theme to a specific item."""def add_texture_registry(*, tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a registry for texture resources."""
def add_static_texture(width: int, height: int, default_value: Union[List[float], Tuple[float, ...]], *, tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a static texture from raw data."""
def add_dynamic_texture(width: int, height: int, default_value: Union[List[float], Tuple[float, ...]], *, tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a dynamic texture that can be updated."""
def add_font_registry(*, tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a registry for font resources."""
def add_font(file: str, size: float, *, tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Loads a font from file."""
def bind_font(font: Union[int, str]) -> None:
"""Sets the active font globally."""
def add_colormap_registry(*, tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a registry for color maps."""
def add_colormap(colors: List[Union[List[int], Tuple[int, ...]]], qualitative: bool, *, tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a color map for data visualization."""def add_file_dialog(*, directory_selector: bool = '', show: bool = '', callback: Callable = '', tag: Union[int, str] = '', width: int = '', height: int = '', default_path: str = '', default_filename: str = '', file_count: int = '', modal: bool = '', **kwargs) -> Union[int, str]:
"""
Creates a file dialog for file selection.
Parameters:
- directory_selector (bool): Select directories instead of files
- callback (Callable): Function called when file is selected
- default_path (str): Initial directory path
- default_filename (str): Default filename
- file_count (int): Maximum number of files to select
- modal (bool): Modal dialog
Returns:
Union[int, str]: File dialog ID
"""
def add_file_extension(extension: str, *, color: Union[List[int], Tuple[int, ...]] = '', custom_text: str = '', **kwargs) -> Union[int, str]:
"""Adds a file extension filter to a file dialog."""
def get_file_dialog_info(file_dialog: Union[int, str]) -> dict:
"""Gets information about the selected file(s)."""
def load_image(file: str) -> Union[List[int], Tuple[int, ...]]:
"""
Loads an image file.
Returns:
tuple: (width, height, channels, data)
"""
def save_image(file: str, width: int, height: int, data: Union[List[float], Tuple[float, ...]], *, components: int = '') -> None:
"""Saves image data to file."""def show_imgui_demo() -> None:
"""Shows the ImGui demo window for reference."""
def show_implot_demo() -> None:
"""Shows the ImPlot demo window for plotting reference."""
def show_item_debug() -> None:
"""Shows the item debugger window."""
def show_tool(tool: int) -> None:
"""Shows a specific developer tool."""
def show_demo() -> None:
"""Shows the DearPyGui demo window."""def add_value_registry(*, tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a registry for storing values."""
def add_bool_value(*, default_value: bool = '', tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a boolean value storage."""
def add_string_value(*, default_value: str = '', tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a string value storage."""
def add_float_value(*, default_value: float = '', tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a float value storage."""
def add_int_value(*, default_value: int = '', tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates an integer value storage."""
def add_color_value(*, default_value: Union[List[float], Tuple[float, ...]] = '', tag: Union[int, str] = '', **kwargs) -> Union[int, str]:
"""Creates a color value storage."""def get_clipboard_text() -> str:
"""Gets text from the system clipboard."""
def set_clipboard_text(text: str) -> None:
"""Sets text to the system clipboard."""
def save_init_file(file: str) -> None:
"""Saves current configuration to initialization file."""
def output_frame_buffer(file: str) -> None:
"""Saves the current frame buffer to an image file."""import dearpygui.dearpygui as dpg
# Create custom theme
with dpg.theme(tag="custom_theme"):
with dpg.theme_component(dpg.mvAll):
dpg.add_theme_color(dpg.mvThemeCol_Button, [100, 150, 200])
dpg.add_theme_color(dpg.mvThemeCol_ButtonHovered, [120, 170, 220])
dpg.add_theme_color(dpg.mvThemeCol_ButtonActive, [80, 130, 180])
dpg.add_theme_style(dpg.mvStyleVar_FrameRounding, 5)
with dpg.window(label="Themed Window", width=300, height=200):
dpg.add_text("This window uses a custom theme")
dpg.add_button(label="Themed Button")
# Apply theme to specific button
themed_button = dpg.add_button(label="Custom Themed Button")
dpg.bind_item_theme(themed_button, "custom_theme")import dearpygui.dearpygui as dpg
def file_selected(sender, app_data):
selections = app_data['selections']
for file_path in selections.values():
print(f"Selected file: {file_path}")
def open_file_dialog():
dpg.show_item("file_dialog")
with dpg.window(label="File Dialog Example", width=400, height=200):
dpg.add_button(label="Open File", callback=open_file_dialog)
# Create file dialog (initially hidden)
with dpg.file_dialog(directory_selector=False, show=False,
callback=file_selected, tag="file_dialog",
width=700, height=400):
dpg.add_file_extension(".py", color=[0, 255, 0, 255])
dpg.add_file_extension(".txt", color=[255, 255, 0, 255])
dpg.add_file_extension(".*")import dearpygui.dearpygui as dpg
def link_callback(sender, app_data):
dpg.add_node_link(app_data[0], app_data[1], parent=sender)
def delink_callback(sender, app_data):
dpg.delete_item(app_data)
with dpg.window(label="Node Editor", width=800, height=600):
with dpg.node_editor(callback=link_callback,
delink_callback=delink_callback):
with dpg.node(label="Node 1", pos=[20, 20]):
with dpg.node_attribute(label="Input"):
dpg.add_input_float(label="A", width=100)
with dpg.node_attribute(label="Output", attribute_type=dpg.mvNode_Attr_Output):
dpg.add_text("Result")
with dpg.node(label="Node 2", pos=[200, 100]):
with dpg.node_attribute(label="Input"):
dpg.add_input_float(label="B", width=100)
with dpg.node_attribute(label="Output", attribute_type=dpg.mvNode_Attr_Output):
dpg.add_text("Output")import dearpygui.dearpygui as dpg
# Create registries
with dpg.texture_registry():
# Create texture from raw data
texture_data = []
for i in range(100 * 100):
texture_data.extend([1.0, 0.0, 1.0, 1.0]) # Magenta pixels
dpg.add_static_texture(width=100, height=100, default_value=texture_data, tag="my_texture")
with dpg.font_registry():
# Load custom font (if available)
try:
dpg.add_font("arial.ttf", 20, tag="custom_font")
except:
pass # Use default font
with dpg.window(label="Resources", width=300, height=200):
# Use texture in image
dpg.add_image("my_texture", width=50, height=50)
# Use font for text
if dpg.does_item_exist("custom_font"):
dpg.bind_font("custom_font")
dpg.add_text("Text with custom font")# Node attribute types
mvNode_Attr_Input: int
mvNode_Attr_Output: int
mvNode_Attr_Static: int
# Node pin shapes
mvNode_PinShape_Circle: int
mvNode_PinShape_CircleFilled: int
mvNode_PinShape_Triangle: int
mvNode_PinShape_TriangleFilled: int
mvNode_PinShape_Quad: int
mvNode_PinShape_QuadFilled: int
# Theme colors
mvThemeCol_Text: int
mvThemeCol_TextDisabled: int
mvThemeCol_WindowBg: int
mvThemeCol_ChildBg: int
mvThemeCol_PopupBg: int
mvThemeCol_Border: int
mvThemeCol_BorderShadow: int
mvThemeCol_FrameBg: int
mvThemeCol_FrameBgHovered: int
mvThemeCol_FrameBgActive: int
mvThemeCol_TitleBg: int
mvThemeCol_TitleBgActive: int
mvThemeCol_TitleBgCollapsed: int
mvThemeCol_MenuBarBg: int
mvThemeCol_ScrollbarBg: int
mvThemeCol_ScrollbarGrab: int
mvThemeCol_ScrollbarGrabHovered: int
mvThemeCol_ScrollbarGrabActive: int
mvThemeCol_CheckMark: int
mvThemeCol_SliderGrab: int
mvThemeCol_SliderGrabActive: int
mvThemeCol_Button: int
mvThemeCol_ButtonHovered: int
mvThemeCol_ButtonActive: int
mvThemeCol_Header: int
mvThemeCol_HeaderHovered: int
mvThemeCol_HeaderActive: int
# Style variables
mvStyleVar_Alpha: int
mvStyleVar_WindowPadding: int
mvStyleVar_WindowRounding: int
mvStyleVar_WindowBorderSize: int
mvStyleVar_WindowMinSize: int
mvStyleVar_WindowTitleAlign: int
mvStyleVar_ChildRounding: int
mvStyleVar_ChildBorderSize: int
mvStyleVar_PopupRounding: int
mvStyleVar_PopupBorderSize: int
mvStyleVar_FramePadding: int
mvStyleVar_FrameRounding: int
mvStyleVar_FrameBorderSize: int
mvStyleVar_ItemSpacing: int
mvStyleVar_ItemInnerSpacing: int
mvStyleVar_IndentSpacing: int
mvStyleVar_CellPadding: int
mvStyleVar_ScrollbarSize: int
mvStyleVar_ScrollbarRounding: int
mvStyleVar_GrabMinSize: int
mvStyleVar_GrabRounding: int
mvStyleVar_TabRounding: int
mvStyleVar_ButtonTextAlign: int
mvStyleVar_SelectableTextAlign: intInstall with Tessl CLI
npx tessl i tessl/pypi-dearpygui