Skip to main content

CTkForge

Custom extension components and widgets for CustomTkinter.

CTkForge Preview

Installation

pip install ctkforge

Features

  • CTkPopup: A modern popup modal dialog widget for alerts, confirmations, and error messages. Includes ready-to-use types (info, warning, error, question, success), keyboard shortcuts (Enter to confirm, Escape to cancel), clean Windows 11 button styling, and automatically turns into a scrollable box for long error text. See detailed documentation.

  • CTkSpinbox: A number input widget with classic up and down arrow buttons (▲/▼). Supports mouse wheel scrolling, arrow key adjustments, minimum/maximum limits, custom steps, and matches CustomTkinter's colors and rounded corners. See detailed documentation.

  • CTkTable: A fast, smooth data table widget built to handle massive datasets without slowing down. Features smart column sorting, row and cell selection, double-click cell editing, copy-pasting (Ctrl+C), auto-fitting column widths, and optional alternating row colors. See API reference, user guide.

  • Universal DPI unscale Helper: Utility function to convert raw physical pixel dimensions from Tkinter (winfo_*) back to unscaled 100% baseline (96 DPI) values for CustomTkinter windows.

  • Resource Locator (resource_path): Robust asset path resolver that finds images, icons, audio, and data files across direct filesystem paths, the script entry directory (sys.argv[0]), and PyInstaller single-file bundle extractions (sys._MEIPASS).

Usage

1. CTkPopup Dialogs

import customtkinter as ctk
from ctkforge import CTkPopup

app = ctk.CTk()

# Quick confirmation dialog (Enter for Yes, Escape for No)
popup = CTkPopup(
    master=app,
    title="Confirm Action",
    text="Do you want to proceed with the update?",
    preset="question",
)

choice = popup.get()
if choice is True:
    print("User clicked Yes")
else:
    print("User clicked No or closed the dialog")

app.mainloop()

(See demo_ctkpopup_basic.py, and demo_ctkpopup_test_suite.py for interactive demos).

2. CTkSpinbox

import customtkinter as ctk
from ctkforge import CTkSpinbox

app = ctk.CTk()

spinbox = CTkSpinbox(
    app,
    start_value=25,
    min_value=1,
    max_value=100,
    step=1,
    width=120,
    height=38,
)
spinbox.pack(padx=20, pady=20)

app.mainloop()

(See demo_ctkspinbox.py for interactive demo).

3. CTkTable Data Grid

import customtkinter as ctk
from ctkforge import CTkTable

app = ctk.CTk()
app.geometry("800x400")

headers = ["ID", "Employee Name", "Department", "Salary"]
data = [
    ["101", "Ada Lovelace", "Research", "£125,000"],
    ["102", "Alan Turing", "Data Systems", "£135,000"],
    ["103", "Grace Hopper", "Engineering", "£130,000"],
]

table = CTkTable(
    app,
    headers=headers,
    values=data,
    column_widths=[90, 220, 180, 140],
    column_types={0: "int"},
    selection_target="row",
    selection_mode="extended",
    editable=True,
    alternate_row_color=("gray92", "gray14"),
)
table.pack(fill="both", expand=True, padx=20, pady=20)

app.mainloop()

(See demo_ctktable_basic.py, and demo_ctktable_clipboard_and_crud.py for interactive demos).

4. Universal DPI Unscaling (unscale)

Convert raw physical pixel values from Tkinter (winfo_*) back to unscaled 100% baseline (96 DPI) values to prevent double-scaling bugs when setting CustomTkinter geometry on High-DPI displays:

import customtkinter as ctk
from ctkforge import unscale

app = ctk.CTk()
app.update_idletasks()

# Unscale multiple physical dimensions simultaneously:
width, height = unscale(app, app.winfo_width(), app.winfo_height())

# Or unscale a single coordinate:
root_x = unscale(app, app.winfo_rootx())

# Set window geometry safely without High-DPI drift:
app.geometry(f"{width}x{height}")

5. Resource Path Resolution (resource_path)

Find files reliably in both development and PyInstaller single-file executables (.exe):

from ctkforge import resource_path

# Finds asset whether running from terminal, script folder, or PyInstaller bundle
icon_path = resource_path("assets/custom_icon.png")

Crafted and maintained by Rafalus. Happy forging!

Metadata

Release files for ctkforge 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 ctkforge 0.2.0
File Size Uploaded Provenance
ctkforge-0.2.0.tar.gz 110.6 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 214.3 kB

Release files / ctkforge-0.2.0.tar.gz

Download URL ctkforge-0.2.0.tar.gz
Size 110.6 kB
Tags Source
SHA-256 checksum
How to use checksums
fcb41257d836581efc359c8942732ac773943c02bba7a7a29b0be689965211bd
BLAKE2b-256 checksum
How to use checksums
8f28fde126af14d56870d595d6412785c6d564699f77ee1fbd7d700f39695c1c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

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

Download URL ctkforge-0.2.0-py3-none-any.whl
Size 103.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
799b1892affc75821ae1bd24e20b17badef142d97d41a010fbe45822728a6a69
BLAKE2b-256 checksum
How to use checksums
3280706d9d0d9222a9a16c4c48ab2db8960c4451e9dba04c7d274847150f1f20
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.15.0

Security for ctkforge 0.2.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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