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
โ”‚
โ”œโ”€โ”€ images/                       # UI preview images
โ”‚   โ”œโ”€โ”€ prompt.png
โ”‚   โ”œโ”€โ”€ confirm.png
โ”‚   โ””โ”€โ”€ alert.png
โ”‚
โ”œโ”€โ”€ 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 installation heavy and slow.

CustomCTkDialog now uses a dynamic runtime loader:

  1. On package import, electron_loader.ensure_electron() runs automatically.
  2. It checks whether the Electron folder picker runtime is already present.
  3. If missing, 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, the ZIP is downloaded from GitHub Releases.
  2. The ZIP is extracted into the package directory.
  3. Future imports detect the runtime and do not download again.

โœ”๏ธ Benefits

  • Very lightweight PyPI package
  • Automatic runtime management
  • Easy to release updates via GitHub

๐Ÿงช Example Usage

Here are the UI components included in the package:

confirm alert prompt

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 the specified AlertType.

folder_picker()

paths = folder_picker()

file_picker()

files = file_picker()

๐Ÿ›  Development

Install dependencies

pip install -r requirements.txt

Run example

python example/app.py

Rebuild JS folder picker

cd js-folder-picker
npm install
npm run build

Upload the resulting ZIP to GitHub Releases.

๐Ÿ“ฆ Build & Publish (maintainers only)

Build

python -m build --no-isolation

Upload to TestPyPI

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

๐Ÿ”’ TestPyPI & PyPI Upload Permissions

To protect users and maintain high-quality releases, upload permissions for both TestPyPI and PyPI are limited to the project owner and approved maintainers.

This ensures:

  • Secure, trusted releases
  • Proper version control
  • A consistent publishing workflow

Want to become a maintainer?

  1. Open an issue on GitHub expressing your interest.
  2. Contact the project owner.
  3. Once approved, your account will be added under Settings โ†’ Collaborators, enabling you to publish updates.

Your contributions are valued โ€” thank you for helping improve the project!

๐Ÿค Contributing

  • Pull requests welcome!
  • JS improvements must be rebuilt before packaging.
  • Release updates through GitHub to support the runtime downloader.

๐Ÿ“ 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.9.tar.gz (10.0 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.9-py3-none-any.whl (10.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: customctkdialog-0.1.9.tar.gz
  • Upload date:
  • Size: 10.0 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.9.tar.gz
Algorithm Hash digest
SHA256 5c1b091e07cccb87d1892838234fd62cf82a4b384d393e5e7b42972b912b5ef8
MD5 277fbc0f4f66338e07aef86a0327abed
BLAKE2b-256 d7ea010d847bf9e50f0b9b12ae8f9c5996de40814765f2b0eaf767f22fe60c23

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for customctkdialog-0.1.9-py3-none-any.whl
Algorithm Hash digest
SHA256 a6f7b5cdd5357e3e97d75f4cad0cefb48bd1486e518285bd1f79c2e39fd92809
MD5 a289fac298f9904f0bcbdb22111358e0
BLAKE2b-256 7038a84b1d4aff10cecf20e0b6396628d7bf7e65ac68f584f0bc77050383b7bf

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