or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

advanced.mdapplication-lifecycle.mddrawing.mdevents.mdindex.mdlayout.mdplotting.mdtables.mdwidgets.md
tile.json

tessl/pypi-dearpygui

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.

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/dearpygui@2.1.x

To install, run

npx @tessl/cli install tessl/pypi-dearpygui@2.1.0

index.mddocs/

DearPyGui

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. Built with a C++ core for high performance, it offers complete theme and style control, great performance through GPU-based rendering, stable operation with asynchronous function support, fast graph rendering capable of displaying over 1 million datapoints at 60 fps with zoom and pan capabilities, an intuitive node editor, built-in demo functionality, and comprehensive developer tools including theme inspection, runtime metrics, and debugging capabilities.

Package Information

  • Package Name: dearpygui
  • Package Type: pypi
  • Language: Python (with C++ extensions)
  • Installation: pip install dearpygui
  • Platform Support: Windows, macOS, Linux
  • Graphics Backends: DirectX 11/12, Metal, OpenGL, Vulkan

Core Imports

import dearpygui.dearpygui as dpg

Additional modules:

import dearpygui.demo as demo  # Built-in demo
import dearpygui.experimental as exp  # Experimental features

Basic Usage

import dearpygui.dearpygui as dpg

# Create application context
dpg.create_context()

# Create a simple window with widgets
with dpg.window(label="Hello World", width=400, height=300):
    dpg.add_text("Hello, DearPyGui!")
    dpg.add_button(label="Click Me!", callback=lambda: print("Button clicked!"))
    dpg.add_input_text(label="Text Input", default_value="Type here...")
    dpg.add_slider_float(label="Slider", default_value=0.5, min_value=0.0, max_value=1.0)

# Create and show viewport
dpg.create_viewport(title="My Application", width=800, height=600)
dpg.setup_dearpygui()
dpg.show_viewport()

# Main application loop
dpg.start_dearpygui()

# Cleanup
dpg.destroy_context()

Architecture

DearPyGui uses an immediate mode GUI paradigm with a hierarchical item system:

  • Context: Global application state and resource management
  • Viewport: Main application window (platform window)
  • Items: All GUI elements (windows, widgets, containers) organized in a tree structure
  • Registries: Resource containers for fonts, textures, themes, handlers, and values
  • Render Loop: Continuous rendering cycle with automatic updates

The framework provides both imperative API calls and context manager patterns for clean, readable code organization.

Capabilities

Application Lifecycle

Core application management including context creation, viewport handling, and main loop control. Essential for every DearPyGui application.

def create_context() -> None: ...
def destroy_context() -> None: ...
def create_viewport(*, title: str = '', width: int = '', height: int = '') -> None: ...
def setup_dearpygui() -> None: ...
def show_viewport() -> None: ...
def start_dearpygui() -> None: ...
def stop_dearpygui() -> None: ...
def is_dearpygui_running() -> bool: ...

Application Lifecycle

Basic UI Widgets

Core interactive elements including input controls, buttons, text display, selection widgets, and color pickers. These form the foundation of most GUI applications.

def add_button(*, label: str = '', callback: Callable = '', **kwargs) -> Union[int, str]: ...
def add_text(default_value: str = '', **kwargs) -> Union[int, str]: ...
def add_input_text(*, label: str = '', default_value: str = '', **kwargs) -> Union[int, str]: ...
def add_slider_float(*, label: str = '', default_value: float = '', min_value: float = '', max_value: float = '', **kwargs) -> Union[int, str]: ...
def add_checkbox(*, label: str = '', default_value: bool = '', **kwargs) -> Union[int, str]: ...
def add_combo(items: Union[List[str], Tuple[str, ...]], *, label: str = '', **kwargs) -> Union[int, str]: ...
def add_color_picker(default_value: Union[List[int], Tuple[int, ...]] = '', **kwargs) -> Union[int, str]: ...

Basic UI Widgets

Layout & Containers

Organizational elements for structuring user interfaces including windows, groups, collapsing sections, tabs, menus, and child containers.

def add_window(*, label: str = '', width: int = '', height: int = '', **kwargs) -> Union[int, str]: ...
def add_child_window(*, label: str = '', width: int = '', height: int = '', **kwargs) -> Union[int, str]: ...
def add_group(*, horizontal: bool = '', **kwargs) -> Union[int, str]: ...
def add_collapsing_header(*, label: str = '', **kwargs) -> Union[int, str]: ...
def add_tab_bar(**kwargs) -> Union[int, str]: ...
def add_tab(*, label: str = '', **kwargs) -> Union[int, str]: ...
def add_menu_bar(**kwargs) -> Union[int, str]: ...
def add_menu(*, label: str = '', **kwargs) -> Union[int, str]: ...

Layout & Containers

Plotting & Data Visualization

Comprehensive plotting system with multiple series types, axes management, and interactive features. Capable of high-performance rendering of large datasets.

def add_plot(*, label: str = '', width: int = '', height: int = '', **kwargs) -> Union[int, str]: ...
def add_plot_axis(axis: int, *, label: str = '', **kwargs) -> Union[int, str]: ...
def add_line_series(x: Union[List[float], Tuple[float, ...]], y: Union[List[float], Tuple[float, ...]], **kwargs) -> Union[int, str]: ...
def add_scatter_series(x: Union[List[float], Tuple[float, ...]], y: Union[List[float], Tuple[float, ...]], **kwargs) -> Union[int, str]: ...
def add_bar_series(x: Union[List[float], Tuple[float, ...]], y: Union[List[float], Tuple[float, ...]], **kwargs) -> Union[int, str]: ...
def add_histogram_series(x: Union[List[float], Tuple[float, ...]], **kwargs) -> Union[int, str]: ...

Plotting & Data Visualization

Drawing & Graphics

Low-level drawing capabilities for custom graphics including shapes, lines, text rendering, and image display with transformation support.

def add_drawlist(*, width: int = '', height: int = '', **kwargs) -> Union[int, str]: ...
def draw_line(p1: Union[List[float], Tuple[float, ...]], p2: Union[List[float], Tuple[float, ...]], *, color: Union[List[int], Tuple[int, ...]] = '', thickness: float = '') -> None: ...
def draw_rectangle(pmin: Union[List[float], Tuple[float, ...]], pmax: Union[List[float], Tuple[float, ...]], *, color: Union[List[int], Tuple[int, ...]] = '', **kwargs) -> None: ...
def draw_circle(center: Union[List[float], Tuple[float, ...]], radius: float, *, color: Union[List[int], Tuple[int, ...]] = '', **kwargs) -> None: ...
def draw_text(pos: Union[List[float], Tuple[float, ...]], text: str, *, color: Union[List[int], Tuple[int, ...]] = '', size: float = '') -> None: ...

Drawing & Graphics

Event Handling

Comprehensive event system for user interactions including mouse events, keyboard input, and item-specific callbacks.

def add_handler_registry(**kwargs) -> Union[int, str]: ...
def add_mouse_click_handler(*, callback: Callable = '', **kwargs) -> Union[int, str]: ...
def add_key_press_handler(*, callback: Callable = '', **kwargs) -> Union[int, str]: ...
def add_item_clicked_handler(*, callback: Callable = '', **kwargs) -> Union[int, str]: ...
def set_frame_callback(frame: int, callback: Callable) -> None: ...

Event Handling

Tables & Data Display

Structured data presentation with sortable columns, row highlighting, and cell-level customization for displaying tabular information.

def add_table(*, label: str = '', **kwargs) -> Union[int, str]: ...
def add_table_column(*, label: str = '', **kwargs) -> Union[int, str]: ...
def add_table_row(**kwargs) -> Union[int, str]: ...
def add_table_cell(**kwargs) -> Union[int, str]: ...
def highlight_table_cell(table: Union[int, str], row: int, column: int, color: Union[List[int], Tuple[int, ...]] = '') -> None: ...

Tables & Data Display

Advanced Features

Specialized functionality including node editors, theming, resource management, file dialogs, and developer tools.

def add_node_editor(**kwargs) -> Union[int, str]: ...
def add_theme(**kwargs) -> Union[int, str]: ...
def add_font_registry(**kwargs) -> Union[int, str]: ...
def add_texture_registry(**kwargs) -> Union[int, str]: ...
def add_file_dialog(*, callback: Callable = '', **kwargs) -> Union[int, str]: ...
def show_item_debug() -> None: ...
def show_demo() -> None: ...

Advanced Features

Common Parameters

Most DearPyGui functions accept these common parameters:

  • label (str): Display text for the item
  • tag (Union[int, str]): Unique identifier for referencing the item
  • parent (Union[int, str]): Parent container (defaults to current container stack)
  • before (Union[int, str]): Item to insert before
  • show (bool): Visibility state (default: True)
  • enabled (bool): Interaction state (default: True)
  • user_data (Any): Custom data storage
  • callback (Callable): Function to call on interaction
  • width (int), height (int): Dimensions
  • pos (Union[List[int], Tuple[int, ...]]): Position [x, y]

Item Management

def configure_item(item: Union[int, str], **kwargs) -> None: ...
def get_item_configuration(item: Union[int, str]) -> dict: ...
def get_value(item: Union[int, str]) -> Any: ...
def set_value(item: Union[int, str], value: Any) -> None: ...
def delete_item(item: Union[int, str]) -> None: ...
def does_item_exist(item: Union[int, str]) -> bool: ...

Context Managers

DearPyGui provides context managers for container widgets:

with dpg.window(label="My Window"):
    # Widgets automatically added to window
    dpg.add_text("Hello!")
    
    with dpg.group(horizontal=True):
        dpg.add_button(label="Button 1")
        dpg.add_button(label="Button 2")

Error Handling

DearPyGui functions may raise exceptions for:

  • Invalid item IDs or tags
  • Mismatched parent-child relationships
  • Invalid parameter values
  • Resource allocation failures

Use does_item_exist() to check item validity before operations.

Performance Considerations

  • Use add_clipper() for large lists to improve rendering performance
  • Bind data to value registries for efficient updates
  • Use GPU-accelerated plotting for large datasets
  • Consider show=False for initially hidden items to reduce initial load
  • Use context managers for cleaner resource management