Skip to main content

Small starter kit for tkinter: clipboard, window helpers, styled widgets, project templates.

Project description

tkstart

PyPI version Python License: MIT Platform

A compact starter kit for tkinter — a curated collection of helpers that take the boilerplate out of small desktop applications. Built so you can have a window on screen in five lines and stay focused on what the app does, not how tkinter wants you to write it.

import tkinter as tk
import tkstart

root = tk.Tk()
root.geometry("400x300")
tkstart.center(root)
tkstart.title(root, "Hello").pack(pady=20)
tkstart.button(root, "OK", command=root.destroy, primary=True).pack()
root.mainloop()

✨ Features

  • 📋 Clipboard helpers — robust copy/paste across Windows, macOS, Linux. Native Windows API path works even on locked-down VM images where clip.exe is missing.
  • 🪟 Window helpers — one-line center() / maximize() / toggle_fullscreen() / set_icon().
  • 🖼️ Image loading — Pillow-powered load_image() and thumbnail() with sensible fallbacks.
  • 🎛️ Styled widget factories — quick button() / title() / labeled_entry() / separator() with a consistent look.
  • 🌈 Colour utilities — hex/RGB conversion, lighten(), darken(), mix(), automatic contrast text picking.
  • Input validatorsrequired, min_length, max_length, is_email, is_phone, is_number, between — all returning None on success.
  • 🎨 Theme presetsLIGHT, DARK, SOFT plus a dataclass-based Theme you can clone and tweak.
  • 🛠️ Utility belt — money formatting, date parsing, slugify, search-tolerant string matching, safe file names.

📦 Installation

pip install tkstart

A single command installs tkstart together with its three runtime dependencies (Pillow, psycopg2-binary, pyperclip), so any project that uses the helpers runs straight out of the box. Tkinter itself ships with Python.

To remove later:

pip uninstall tkstart

🧩 Modules

Module Purpose
tkstart.clipboard copy, paste, clear, last_resort_path
tkstart.window center, maximize, toggle_fullscreen, set_icon
tkstart.images load_image, thumbnail
tkstart.widgets button, title, separator, labeled_entry
tkstart.colors hex_to_rgb, rgb_to_hex, lighten, darken, mix, luminance, is_dark, contrast_text
tkstart.validation required, min_length, max_length, is_email, is_phone, is_number, between
tkstart.theme Theme, LIGHT, DARK, SOFT, apply, current, reset
tkstart.utils format_money, parse_date, format_date, today_str, truncate, matches_search, slugify, safe_filename

📚 Examples

Clipboard

import tkstart

tkstart.copy("hello world")
print(tkstart.paste())   # 'hello world'
tkstart.clear()

Window helpers

import tkinter as tk
import tkstart

root = tk.Tk()
root.geometry("500x400")
tkstart.center(root)
tkstart.set_icon(root, "icon.ico")
root.mainloop()

Validators

from tkstart import validation as v

v.required("hello")            # None — valid
v.required("")                 # 'value is required'
v.is_email("user@host.com")    # None
v.is_phone("+7 999 123 45 67") # None
v.between("50", 0, 100)        # None

Colours

from tkstart import colors

colors.hex_to_rgb("#7FFF00")     # (127, 255, 0)
colors.lighten("#42A5F5", 0.3)
colors.darken("#42A5F5", 0.3)
colors.mix("#FF0000", "#0000FF", 0.5)
colors.contrast_text("#FFFFFF")  # '#000000'

Themes

from tkstart import theme

theme.apply(theme.DARK)
t = theme.current()
print(t.bg, t.primary, t.font)

custom = theme.LIGHT.copy(primary="#FF5722")
theme.apply(custom)

Money & dates

from tkstart import utils

utils.format_money(1500)          # '1500.00 ₽'
utils.parse_date("2026-06-02")    # date(2026, 6, 2)
utils.parse_date("02.06.2026")    # date(2026, 6, 2)
utils.today_str()                 # '2026-06-02'
utils.truncate("a long string", 8)

🖥️ Compatibility

Versions
Python 3.8 — 3.12
Windows 7 / 8 / 10 / 11
macOS 10.13 +
Linux any X11 / Wayland session

📄 License

MIT — see LICENSE for details.

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

tkstart-1.0.5.tar.gz (34.3 kB view details)

Uploaded Source

Built Distribution

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

tkstart-1.0.5-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file tkstart-1.0.5.tar.gz.

File metadata

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

File hashes

Hashes for tkstart-1.0.5.tar.gz
Algorithm Hash digest
SHA256 e061275af92ec38c84e33ca437e323e18e2fee109d97b1c150ffc9f3900a56b5
MD5 01e8f5b746b0dc78492e33f78c7e56a1
BLAKE2b-256 460f98e2a3cba687def0db2fe619352723afdd3b167078bf0880f93152e7b1d5

See more details on using hashes here.

File details

Details for the file tkstart-1.0.5-py3-none-any.whl.

File metadata

  • Download URL: tkstart-1.0.5-py3-none-any.whl
  • Upload date:
  • Size: 33.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.0

File hashes

Hashes for tkstart-1.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 961c88d04eb3952d06cafc6eb04e24350c14b84580e788951b7d9b248a621ecd
MD5 5c33aa3e72aa181805b586ce06f7157a
BLAKE2b-256 c4bacdfbb72e6739afe43a5e85d5ee6173074e0b364d34d5aa0346f87b84a2b3

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