Skip to main content

A custom dialog component for CustomTkinter

Project description

🎉 CustomCTkDialog

Beautiful dialogs, alerts, and native file pickers for CustomTkinter — powered by a lightweight Electron executable.

✨ Features

✔️ Modern dialogs that blend perfectly with CustomTkinter ✔️ Custom alert boxes with multiple alert types ✔️ Native-feeling folder picker powered by a lightweight Electron executable ✔️ Plug-and-play — no configuration required ✔️ Clean, Pythonic API ✔️ Automatic runtime download — no large .exe included in the package

🚀 Installation

pip install CustomCTkDialog

📦 Project Structure

CustomCTkDialog/
│
├── CustomCTkDialog/              # Python package
│   ├── __init__.py
│   ├── electron_loader.py        # Downloads Electron runtime on import
│   ├── dialog_main.py            # Main dialog system
│
├── js-folder-picker/             # JS workspace (developers only)
│   ├── folder-picker.js
│   ├── package.json
│   └── build scripts
│
├── example/
│   └── app.py                    # Example usage
│
├── README.md
└── pyproject.toml

📝 Note: The js-folder-picker/ folder is not included in the published Python package.

🔄 Runtime Logic with electron_loader

Previously, the Python package included a large bundled .exe, which made the package heavy and slowed down installation.

Now, CustomCTkDialog uses a dynamic runtime loader:

  1. When the package is imported, electron_loader.ensure_electron() is executed automatically.
  2. It checks if the Electron-based folder picker is already present.
  3. If not, the user is prompted:
Some necessary files are required for CustomCTkDialog.folder_picker to work.
Download these files now? (Y/n):
  1. If the user agrees (default Yes), the ZIP distribution of the folder picker is downloaded from the GitHub releases page.
  2. The ZIP is extracted into the package folder.
  3. Subsequent imports detect the runtime and do not re-download, making the process fast after the first run.

✅ Advantages:

  • Lightweight PyPI package (no 100MB .exe inside)
  • Automatic setup for users
  • Updates can be released via GitHub without republishing the Python package

🧪 Example Usage

from CustomCTkDialog import Dialog, folder_picker, file_picker, AlertType

# Prompt input
try:
    name = Dialog.prompt("Enter your name:", default_text="Alice")
    print("Prompt returned:", name)
except ValueError as error:
    print("Prompt canceled:", error)

# Confirm dialog
confirmed = Dialog.confirm("Do you want to continue?")
print("Confirm returned:", confirmed)

# Alert
Dialog.alert(AlertType.SUCCESS, "Test Alert", "This is a success alert!")

# File picker
files = file_picker(initialdir="D:/")
print("Selected files:", files)

# Folder picker (Electron runtime downloads automatically on first run)
directories = folder_picker(initialdir="D:/")
print("Selected folders:", directories)

🧰 API Reference

Dialog class

Method Description
prompt() Shows an input dialog, returns string or raises ValueError.
confirm() Shows a yes/no dialog, returns boolean.
alert() Shows an alert with AlertType.

folder_picker()

Opens a native folder picker. Downloads the Electron runtime automatically if missing.

paths = folder_picker()

file_picker()

Wrapper around tkinter.filedialog.askopenfilenames.

files = file_picker()

🛠 Development

1. Install Python dependencies

pip install -r requirements.txt

2. Run the example app

python example/app.py

3. Rebuild the JS folder-picker (developers only)

cd js-folder-picker
npm install
npm run build
  • Upload the resulting ZIP to a GitHub release.
  • electron_loader will download it automatically when the package is imported.

📦 Build & Publish (maintainers only)

Build the package

python -m build --no-isolation

Upload to TestPyPI

python -m twine upload --verbose --repository testpypi dist/*

🔒 TestPyPI & PyPI Upload Permissions

To maintain the integrity and security of the package, only the project owner and designated maintainers have permission to upload new versions to:

  • TestPyPI
  • PyPI

This ensures that releases are carefully reviewed and that users receive safe, consistent updates.

If you are not currently a maintainer, you will not be able to upload new versions, even if you have:

  • Your own API token
  • Your own TestPyPI or PyPI account
  • A local project with the same package name

How to become a maintainer

If you would like to assist with publishing or maintaining the project:

  1. Open an issue on GitHub expressing your interest.
  2. Contact the project owner to request maintainer access.
  3. Once approved, you will be added under Settings → Collaborators and can use your API token to upload new releases.

We appreciate contributions from the community and want to ensure that all releases remain reliable and secure for everyone.

🤝 Contributing

  • Pull requests welcome!
  • For JS folder-picker improvements: modify /js-folder-picker/ and rebuild the ZIP.
  • Push new releases to GitHub so electron_loader can fetch them automatically.

📝 License

Creative Commons Attribution–NonCommercial 4.0 (CC BY-NC 4.0)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

customctkdialog-0.1.8.tar.gz (9.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

customctkdialog-0.1.8-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file customctkdialog-0.1.8.tar.gz.

File metadata

  • Download URL: customctkdialog-0.1.8.tar.gz
  • Upload date:
  • Size: 9.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for customctkdialog-0.1.8.tar.gz
Algorithm Hash digest
SHA256 b273fbfd453ca9e41df6f221fc6643f77120fe7e109667fc25c70fcfaece735b
MD5 b639fc1ab98a630cae8561a71e9058fe
BLAKE2b-256 0f33a46503016630963d951d47a95c74f510f57303274ddcd3e08e88b08f63d0

See more details on using hashes here.

File details

Details for the file customctkdialog-0.1.8-py3-none-any.whl.

File metadata

File hashes

Hashes for customctkdialog-0.1.8-py3-none-any.whl
Algorithm Hash digest
SHA256 749be0fea0a5b54c2f6aebdccb2e2b26964ca1528fd536f589da54ac333cab88
MD5 2e1da2a9b6a511140af3b63c6c1db0ea
BLAKE2b-256 043b3093a37ac0ab65a099ac95c85fbf830732d74eb98a189caab3ccdb82c269

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page