Skip to main content

A modern, declarative Tkinter wrapper.

Project description

easygui-tk

A modern, declarative wrapper for Tkinter.

easygui-tk is a lightweight Python library designed to make building desktop applications fast, readable, and fun. It wraps the standard tkinter library in a clean, declarative API, allowing you to build complex interfaces—including layouts, menus, and custom widgets—with minimal code.

🚀 Features

  • Declarative Syntax: Define your entire UI hierarchy in a single with block.
  • Lazy Execution: Windows are configured first and launched only when you're ready.
  • Built-in Themes: Switch between "Default", "Dark", "SciFi", and "Terminal" instantly, or inject your own.
  • Rich Widgets: Includes standard inputs plus Tables (Treeview), Date Pickers, Color Pickers, and Canvas support.
  • Layout Management: Easy-to-use Rows, Tabs, and Scrollable Columns.
  • Modal Dialogs: Create blocking popup forms to collect user input mid-execution.
  • Zero Dependencies: Built entirely on the standard library (tkinter, calendar, datetime).

📦 Installation

This library is designed to be installed as a local package or via pip.

pip install easygui-tk

(Note: If you are building from source, run pip install -e . in the root directory)

⚡ Quick Start

import easygui_tk as eg

def greet(app):
    name = app.get_data("name_field")
    app.msg(f"Hello, {name}!")

# Define the UI Blueprint
with eg.args(title="My First App", theme="Dark") as bp:
    bp.add("label", "Welcome to easygui-tk", font=("Arial", 16, "bold"))
    bp.add_spacer(10)
    
    bp.add("label", "Enter your name:")
    bp.add("inputbox", id="name_field")
    
    bp.add("button", "Say Hello", command=greet)

# Launch the Window
mw = eg.window(bp)
mw()

📖 Widget Reference

Use bp.add("type", ...) to add widgets. Common arguments include id (to retrieve data later), text, command, and standard styling options like bg, fg, width.

Basic Inputs

Type Description label Static text display. button Clickable button. Calls command(app). inputbox Single-line text entry. textbox Multi-line text area. dropdown Selection list (Combobox). Use values=["A", "B"]. checkbox Toggle switch (0 or 1). radio Exclusive selection group. Use values=["A", "B"].

Visuals

Type Description image Displays a PNG/GIF. Use image_path="logo.png". progress Progress bar (min, max). slider Draggable scale. canvas Drawing area. Use app.draw() to add shapes dynamically.

Advanced Widgets

Type Description treeview Data table. Use columns=["Name", "Age"] and data=[("Alice", 30)]. date Input with a popup calendar selector. color Color preview with a popup color chooser.

🏗 Layouts

Nest these context managers inside your main with block to organize widgets.

Rows (Side-by-Side):

with bp.row():
    bp.add("button", "Left")
    bp.add("button", "Right")

Tabs:

with bp.tabs():
    with bp.tab("General"):
        bp.add("label", "Settings here...")
    with bp.tab("Profile"):
        bp.add("inputbox", id="username")

Scrollable Areas:

with bp.scrollable_column(height=300):
    # Add as many widgets as you want here
    for i in range(50):
        bp.add("label", f"Item {i}")

🎨 Theming

Built-in Themes Pass theme="Name" to eg.args().

Default (Standard System Look)

Dark (Modern Dark Mode)

SciFi (High Contrast Neon/Black)

Terminal (Green on Black)

Custom Themes Register your own theme at the start of your script:

eg.add_theme("Ocean", bg="#e0f7fa", fg="#006064", select="#4dd0e1")

with eg.args(theme="Ocean") as bp:
    ...

🛠 Interaction API

The app object passed to your functions provides powerful tools:

Data: app.get_data("id"), app.set_value("id", val)

Popups: app.msg("Hello"), app.error("Oops"), app.confirm("Are you sure?"), app.ask_string("Name?")

Files: app.open_file(), app.save_file(), app.pick_folder()

Drawing: app.draw("canvas_id", "oval", [x1, y1, x2, y2], fill="red")

Modals: data = app.dialog(blueprint) (Blocks code execution until closed)

📄 License

MIT License. Free to use for personal and commercial projects.

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

easygui_tk-1.0.0.tar.gz (12.1 kB view details)

Uploaded Source

Built Distribution

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

easygui_tk-1.0.0-py3-none-any.whl (10.3 kB view details)

Uploaded Python 3

File details

Details for the file easygui_tk-1.0.0.tar.gz.

File metadata

  • Download URL: easygui_tk-1.0.0.tar.gz
  • Upload date:
  • Size: 12.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for easygui_tk-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e01925ae8d67d4fc1addf955379326d479c1f38651029d75e8bc9ea3b9e6f99e
MD5 d6cb63bc4c130c4c436ca3244b9322ac
BLAKE2b-256 862542815bd568e38c928a1c4d2d85bb76a60e55284775b243b04718a9acce8d

See more details on using hashes here.

File details

Details for the file easygui_tk-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: easygui_tk-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 10.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for easygui_tk-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5f6dd55bc79b2800fc1e72866375e3267838ab5a9d5f4cf03c8f7a7ea1488b74
MD5 b60df087db97f61c2e47822db2698282
BLAKE2b-256 c0dfeee2492894c7325dac03b6c9a9ce88e92739540579321c7dc3cb333a5247

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