Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

dpg-navigator

File dialog with rich preview panel for DearPyGui — images, PDF, Word, Excel, archives, and more.

Inspired by file_dialog by Dr. AIT. Rebuilt from scratch as a modular, fully typed, cross-platform library.

Installation

From PyPI:

pip install dpg-navigator

With all optional preview dependencies:

pip install dpg-navigator[all]

From source:

pip install .

Runtime and extra dependencies are declared only in pyproject.toml. requirements.txt is a pointer so pip install -r requirements.txt still installs this project; do not add version pins there.

Third-party licenses (including bundled Icons8 assets) are listed in THIRD_PARTY_NOTICES.md.

Quick Start

import dearpygui.dearpygui as dpg
from dpg_navigator import FileDialog

dpg.create_context()

def on_select(selected_files):
    for f in selected_files:
        print(f)

fd = FileDialog(callback=on_select, default_path="..")

with dpg.window(label="Main", width=400, height=200):
    dpg.add_button(label="Open file dialog", callback=lambda: fd.show())

dpg.create_viewport(title="Example")
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
fd.destroy()
dpg.destroy_context()

The callback can be changed at any time via fd.change_callback(new_handler).

Selecting a file inside an archive (Enter, OK, or double-click) extracts it to a session temp directory and passes that real filesystem path to the callback. Those temp files are deleted when the last FileDialog in the process is destroy()ed — copy or open them before tearing down the dialog if the host still needs the bytes.

Features

  • Modal or non-modal file and directory picker
  • Modern 3D Fluency icons for 100+ file extensions
  • Sidebar with special directories and an expandable drive tree
  • Real-time search with recursive subfolder indexing
  • File type filtering and multi-selection (Ctrl+click, Ctrl+A)
  • Asynchronous directory size calculation with caching
  • Keyboard navigation: Esc, F5, Ctrl+A, Alt+Up (Cmd on macOS)
  • Drag-and-drop payload support
  • Hidden files toggle
  • New folder creation with path traversal protection
  • Two sidebar styles: labeled (icon + text) and compact (icon-only)
  • Cross-platform: Windows, Linux, macOS

Architecture

The package keeps filesystem/search logic separate from DearPyGui rendering:

  • FileDialog orchestrates the dialog and public lifecycle.
  • dialog/_state.py, dialog/_logic.py, and dialog/_ui.py hold state, GUI-free behavior, and widget construction. Drive lists are computed off-thread and applied on the DearPyGui thread.
  • _preview_registry.py routes file extensions, while PreviewPanel delegates rendering to format-specific classes in renderers/.
  • Preview loaders such as _preview_word.py and _preview_spreadsheet.py return plain data and can be tested without a DearPyGui context.

Rich Preview Panel

The integrated preview panel renders files directly inside the dialog:

  • Images — native stb_image loading with Pillow fallback for WebP, TIFF, HEIC, and SVG; the first view fits the pane without cropping. Mouse wheel zooms toward the cursor; left-button drag pans. With Pillow and NumPy installed, large photos are shown from a texture capped at 2048 px on the long edge so they appear without stalling the UI.
  • PDF — page-by-page rendering via pypdfium2 with mouse wheel navigation over the preview panel (wheel down = next page, wheel up = previous page), LRU cache, and background prefetch.
  • Word (.docx) — pixel-perfect HTML render via mammoth + Chrome Headless, or python-docx styled text extraction as fallback.
  • PowerPoint (.pptx) — slide text, tables, speaker notes, and inline image extraction via python-pptx.
  • Markdown — rendered preview using the markdown library piped through Chrome Headless with a dark theme.
  • HTML — Chrome Headless rendering with a scrollable viewport, auto-trim, and responsive resize.
  • CSV / TSV — native DPG table with automatic delimiter detection via csv.Sniffer.
  • Excel (.xlsx) — read-only table display via openpyxl with sheet switching.
  • SQLite (.db) — read-only table browsing with table switching.
  • Fonts (.ttf / .otf) — live glyph preview with pangrams.
  • Archives (.zip / .7z) — file list with compression ratios; click a row to extract and preview.
  • Source code — monospace text preview (same encoding detection as other text files).
  • XML — pretty-printed via minidom.

Optional preview backends are detected at import time. When a preview-specific dependency or browser is unavailable, the dialog falls back to a text view or an explanatory message instead of failing during import.

Optional Dependencies

Preview features are organized into installable extras:

Extra Command What it enables
preview pip install dpg-navigator[preview] Enhanced image formats (WebP, TIFF, SVG)
pdf pip install dpg-navigator[pdf] PDF page rendering
word pip install dpg-navigator[word] Word document preview
pptx pip install dpg-navigator[pptx] PowerPoint slide preview
html pip install dpg-navigator[html] HTML rendered preview
markdown pip install dpg-navigator[markdown] Markdown rendered preview
excel pip install dpg-navigator[excel] Excel spreadsheet preview
archive pip install dpg-navigator[archive] 7z archive browsing
code pip install dpg-navigator[code] Source-code files as text (pygments_available() / routing)
all pip install dpg-navigator[all] All of the above

Chrome/Chromium required for some previews. The html, markdown, and the pixel-perfect word previews render through Chrome Headless (driven by html2image's --screenshot CLI). Installing the extra pulls in the Python packages but not a browser. A Chrome, Chromium, or chrome-headless-shell binary must be resolvable: set DPG_CHROME_BIN (preferred), CHROME_BIN, or CHROME_PATH, or leave html2image to search PATH. Full Chrome for Testing can hang on --screenshot; the old-headless chrome-headless-shell binary from Chrome for Testing is the reliable CLI. If none is found (or a preview extra is not installed), HTML files fall back to raw-text rendering, and Markdown/Word degrade to their text extractors. In the default safe mode scripts never run: the HTML is sanitized with bleach (an allow-list that drops <script>, event-handler attributes, and javascript: URLs) and wrapped in a Content-Security-Policy with script-src 'none'. Network access is blocked through a dead proxy (--proxy-bypass-list=<-loopback> sends loopback HTTP through that proxy; file:// is not an HTTP proxy hop). Markdown and Word previews always use safe mode. With trusted_html_preview=True, raw .html/.htm files render unsanitized: JavaScript runs and the page may load local and network resources. Enable it only for files you trust. Containers/CI that cannot start the sandbox may set DPG_CHROME_NO_SANDBOX=1 (weakens isolation; not the default).

Configuration

All options can be passed as keyword arguments:

fd = FileDialog(
    callback=on_select,
    title="Open File",
    width=950,
    height=650,
    default_path="/home/user",
    modal=True,
    multi_selection=True,
    show_hidden=False,
    show_preview=True,
    trusted_html_preview=False,
    file_filter=".*",
    allow_drag=True,
    show_dir_size=False,
)

Or via a DialogConfig object for full control (DialogConfig validates sizes, filters, paths, and custom_dirs at construction):

from dpg_navigator import FileDialog, DialogConfig, DialogMode, StyleVariant

config = DialogConfig(
    mode=DialogMode.OPEN_DIRS,
    style=StyleVariant.COMPACT,
)
fd = FileDialog(callback=on_select, config=config)

Security and Reliability

  • Path traversal protection — rigorous validation of paths and folder names.
  • SQL injection hardening — quoted identifiers for SQLite table browsing.
  • Binary file detection — automatic detection of non-text files to prevent UI hangs.
  • ZipSlip protection — safe extraction of archive entries with path validation.
  • Graceful degradation — missing optional libraries are logged, never crash the dialog.
  • Memory efficiency — LRU texture caching and background indexing for deep searches.
  • Safe HTML by default — raw HTML, Markdown, and Word HTML are parsed with a structural allow-list and wrapped in a restrictive CSP before Chrome sees them. Scripts, event handlers, forms, frames, author CSS, local/network URLs, and all non-embedded resources are removed or blocked. Safe mode permits only verified data:image raster sources and also routes network requests through a dead proxy.
  • Trusted HTML is explicit — set trusted_html_preview=True only when raw .html/.htm fidelity is required. That mode can execute scripts and load local or remote resources. It still uses the Chrome sandbox, a 2 MiB input limit, a 30-second subprocess timeout, and a fresh temporary profile per render. Markdown and Word never inherit this option.
  • Thread-safe previews — Chrome and image processing run in bounded workers; DearPyGui texture, widget, and callback work is applied by a frame callback under the DPG mutex. This requires DearPyGui 2.2 or newer.

HiDPI / 4K Displays (Windows)

Add this before dpg.create_context() to prevent blurry fonts under Windows display scaling:

import sys
if sys.platform == "win32":
    import ctypes
    ctypes.windll.shcore.SetProcessDpiAwareness(2)

Unicode filenames

DearPyGui's default font does not contain every Unicode glyph. If the dialog must show filenames with Polish or other non-ASCII characters, bind a system font with Unicode coverage after dpg.create_context() and before creating FileDialog. The demo and examples use the helper below, which also handles older DearPyGui versions that need explicit glyph ranges:

from dpg_navigator.renderers.font import load_font_with_unicode

with dpg.font_registry():
    ui_font = load_font_with_unicode("C:/Windows/Fonts/segoeui.ttf", 16)
dpg.bind_font(ui_font)

Requirements

Development

pip install -e ".[dev]"
python -m ruff check .
python -m ruff format --check .
python -m mypy
pytest
python -m pytest -q --cov=dpg_navigator --cov-report=term-missing
# same ruff/mypy checks as a git hook (Python >= 3.10, venv must be active)
pre-commit install
pre-commit run --all-files
# opt-in real DearPyGui smoke (needs a display). CI runs this under xvfb
# as a required job (DPG_CHROME_NO_SANDBOX=1, chrome-headless-shell).
DPG_INTEGRATION=1 pytest -m integration
# headless Linux:
xvfb-run -a env DPG_INTEGRATION=1 pytest -m integration

Maintainer release steps are documented in docs/releasing.md.

Performance-sensitive pure-data paths can be measured with:

python benchmarks/benchmark_heavy_paths.py --profile default --iterations 3

See benchmarks/README.md for the quick profile and JSON output.

Author

Created and maintained by HACE.

Credits

License

MIT — Copyright (c) 2024–2026 HACE

Bundled icons and declared third-party packages: THIRD_PARTY_NOTICES.md.

Metadata

Release files for dpg-navigator 1.0.0b9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for dpg-navigator 1.0.0b9
File Size Uploaded Provenance Actions
dpg_navigator-1.0.0b9.tar.gz 278.7 kB With provenance Details for dpg_navigator-1.0.0b9.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for dpg-navigator 1.0.0b9
File Interpreter ABI Platform Actions
dpg_navigator-1.0.0b9-py3-none-any.whl Python 3 none any Details for dpg_navigator-1.0.0b9-py3-none-any.whl

Total release size: 487.8 kB

Release files / dpg_navigator-1.0.0b9.tar.gz

Download URL dpg_navigator-1.0.0b9.tar.gz
Size 278.7 kB
Tags Source
SHA-256 checksum
How to use checksums
96a127f3795cc3b908ed5aafec798d905b254085fe10db69b9c97d8d596f64ae
BLAKE2b-256 checksum
How to use checksums
6eacd67e40530858f6b343d86e4ab0d661cb4acb32fbbcb6de1100f668cbcef7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Release files / dpg_navigator-1.0.0b9-py3-none-any.whl

Download URL dpg_navigator-1.0.0b9-py3-none-any.whl
Size 209.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09f4351b0faf57c4094ae89fbbcfe05baa07330d91a4e80467c776c79d206d12
BLAKE2b-256 checksum
How to use checksums
e0f36b563ed701b0b6ced14c7bc78ab30b4a5247173b7136f2680209b47a3674
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

Security for dpg-navigator 1.0.0b9

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for dpg_navigator-1.0.0b9.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 23, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page