Skip to main content

imgui_data_loader

PyPI version Python 3.10+ License: MIT

A configurable file / folder open dialog widget in python

install · quick start · examples · configuration · issues

imgui_data_loader file dialog
The full example — a source selector, a two-column action grid, and a formats panel.

About

Built on imgui-file-dialog and imgui-bundle. It gives you:

  • a small, styled launcher window — your title, help/info content, and buttons that open the OS-native picker (via portable_file_dialogs)
  • configurable buttons — open a file, many files, a folder, or save
  • customizable file-type filters, theme, an info card, and an options popup
  • one-shot use that returns the picked path, or embed it as a panel in a larger app

What you can do with imgui is endless, I often take inspiration from this list of imgui examples.

Install

imgui_data_loader is on PyPI:

pip install imgui_data_loader

The only dependency is imgui-bundle (which provides imgui, hello_imgui, immapp, portable_file_dialogs and the FontAwesome icon font).

Quick start

from imgui_data_loader import run_file_dialog, FileDialogConfig

result = run_file_dialog(FileDialogConfig())   # default Open File(s) / Select Folder

if result:                      # truthy only for a real selection
    print(result.paths)         # list[str]
    print(result.path)          # first path, or None
else:
    print("cancelled")

run_file_dialog opens the window, blocks until the user picks something or quits, and returns a DialogResult.

Examples

See all examples in examples/.

name file preview
dialog_minimal dialog_minimal.py dialog_minimal preview
dialog_full_example dialog_full_example.py dialog_full_example preview
dialog_themes dialog_themes.py dialog_themes preview

Configuration reference

FileDialogConfig fields:

field default purpose
title, subtitle "Open Data", "" header text
buttons Open File(s) + Select Folder list of ButtonSpec
filetypes [All Files] default filters for file/save buttons
default_dir "" picker start dir (else persistence, else ~)
theme Theme.dark() colors
header_draw None replace the title/subtitle block
top_draw None content between header and buttons
info None callback(s) drawn in the info card
body_draw None full-width content under the info card, for forms and tables
options_draw None Options popup content (also toggles the button)
footer_draw None replace the Options/Quit row
options_label "Options" popup + button label
show_options_button True show Options (needs options_draw)
show_quit_button, quit_label True, "Quit" Quit button
quit_on_escape True Esc cancels
close_on_select True exit the run loop after a pick or cancel (one-shot mode)
window_title, window_size, resizable — OS window (one-shot)
ini_path ~/.imgui_data_loader/file_dialog.ini where the layout .ini is saved
assets_folder None folder providing the icon font; unset never overrides a host app's assets folder
persistence None a PreferenceStore
on_select, on_cancel None result callbacks

Draw slots

header_draw, top_draw, info, body_draw, options_draw, and footer_draw let you render your own content in specific regions — the header block, a row above the buttons, the info card, a full-width area under the card, the options popup, and the footer. The footer stays at the bottom of the window; everything above it scrolls when it outgrows the window. Each runs inside a live imgui frame, so any widget bundled with imgui-bundle works: animated toggles, rotary knobs, spinners, markdown, command palettes, cool bars, and the rest. Pair them with the library's themed helpers (center_text, icon_button, push_button_style, …) and dlg.theme so your additions match the dialog's styling.

Files on disk

Everything the library writes lives under one dot directory, ~/.imgui_data_loader/ (override the location with the IMGUI_DATA_LOADER_HOME env var):

path written by purpose
~/.imgui_data_loader/file_dialog.ini run_file_dialog hello_imgui window layout (position/size). Override per dialog with config.ini_path; an embedding app's own ini_filename always wins.
~/.imgui_data_loader/recent.json JsonPreferenceStore recent files + last-used directories (global and per pick kind). Only written if you opt into persistence=JsonPreferenceStore(); pass path= to relocate.
~/.imgui_data_loader/assets/ you (optional) user assets folder. Never created automatically; if it exists it is added to hello_imgui's asset search path when the icon font can't be resolved.

Assets resolution: the dialog needs FontAwesome 6 (fonts/Font_Awesome_6_Free-Solid-900.otf) for its icons. ensure_assets() never replaces an assets folder your app already configured — if the font resolves, nothing is touched; otherwise ~/.imgui_data_loader/assets and then imgui-bundle's bundled assets are added as search paths. Passing config.assets_folder explicitly does set the assets folder to that path.

Embedding apps with their own app dir (e.g. one that keeps everything under ~/.myapp) should point both knobs there: config.ini_path for the layout file and a custom PreferenceStore (or JsonPreferenceStore(path=...)) for recents — nothing then touches ~/.imgui_data_loader.

Notes

  • Buttons open the OS-native dialog, so a desktop session is required (no in-window file browser).
  • Icons come from FontAwesome 6 (Solid only), which ships inside imgui-bundle; a few non-solid glyphs render as a blank box — pick a solid icon if one shows empty.
  • Draw callbacks run inside an active imgui frame — only call imgui from them.

Acknowledgements

This dialog started life inside mbo_utilities at the Miller Brain Observatory, where the original file/folder loader was built.

License

MIT

Metadata

Release files for imgui_data_loader 0.2.0

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

Source distribution (sdist)

Source distribution for imgui_data_loader 0.2.0
File Size Uploaded
imgui_data_loader-0.2.0.tar.gz 26.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for imgui_data_loader 0.2.0
File Interpreter ABI Platform
imgui_data_loader-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 48.3 kB

Release files / imgui_data_loader-0.2.0.tar.gz

Download URL imgui_data_loader-0.2.0.tar.gz
Size 26.9 kB
Tags Source
SHA-256 checksum
How to use checksums
4b54032a0cadd724593093fa4073bceb0b6f22788c9f835b6c4942e651d23437
BLAKE2b-256 checksum
How to use checksums
478bfe5029879264405a04617c5f18d6dc00bd3f2e02c4e30cc1e37036d16827
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / imgui_data_loader-0.2.0-py3-none-any.whl

Download URL imgui_data_loader-0.2.0-py3-none-any.whl
Size 21.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3623a6e273d4da251340836b181feaf9a953f4270955f1d439294278211bda9d
BLAKE2b-256 checksum
How to use checksums
f7f8d8fe7875e149768d61d30fdfebf99d756d317da41a7fb7adda8b769ee1eb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

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