Skip to main content

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

Project description

tkstart

License: MIT Python

A small starter kit for tkinter: clipboard helpers, window positioning, image loading, styled widget factories, and a tiny library of project templates. The package is dependency-free for its core; image helpers optionally use Pillow when installed.

Installation

pip install tkstart

Optional extras:

pip install tkstart[images]      # adds Pillow for richer image support
pip install tkstart[clipboard]   # adds pyperclip as the preferred adapter

Quick start

import tkinter as tk
import tkstart

root = tk.Tk()
root.geometry("400x300")
tkstart.center(root)               # position window on the primary screen
tkstart.set_icon(root, "icon.ico") # silently no-op if file is missing

tkstart.title(root, "Hello").pack(pady=20)
tkstart.button(root, "OK", command=root.destroy, primary=True).pack()

root.mainloop()

API overview

tkstart.clipboard

Function Purpose
copy(text) Write text to the system clipboard, returns bool.
paste() Return current clipboard contents as str.
clear() Empty the clipboard.

Strategies are tried in order: pyperclip (if installed) → native CLI (clip.exe / pbcopy / xclip / xsel) → tkinter fallback.

tkstart.window

Function Purpose
center(window) Position window in the centre of the primary screen.
maximize(window) Maximize using the most reliable per-platform call.
toggle_fullscreen(window, state=None) Toggle (or force) full-screen mode.
set_icon(window, path) Set window icon from .ico / .png.

tkstart.images

Function Purpose
load_image(path, size=None) Return a tkinter PhotoImage.
thumbnail(path, max_size=(128,128)) Return a downscaled thumbnail.

tkstart.widgets

Function Purpose
button(parent, text, command=None, primary=False, danger=False) Styled tk.Button.
title(parent, text) Large-bold label.
separator(parent) Horizontal divider.
labeled_entry(parent, label) Row containing a label and an Entry.

tkstart.templates

Ready-made starter snippets bundled with the package.

Function Purpose
templates() List available template names.
get_template(name) Return the raw text of a template.
copy_template(name) Copy the template to the system clipboard.
save_template(name, path=None) Save the template to a file.
print_template(name) Print the template to stdout.

Current templates:

  • crud_app — a tkinter CRUD application skeleton suitable as a starting point for course projects.
  • sql_schema — a matching PostgreSQL schema for the CRUD demo.
>>> import tkstart
>>> tkstart.templates()
['crud_app', 'sql_schema']
>>> tkstart.copy_template("crud_app")        # then Ctrl+V in your editor
[tkstart] copied 'crud_app' (16953 chars)
>>> tkstart.save_template("sql_schema", "schema.sql")
[tkstart] saved 'sql_schema' (20550 chars) -> /full/path/schema.sql

Compatibility

  • Python 3.8 — 3.12
  • Windows, macOS, Linux

License

MIT

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.0.tar.gz (23.7 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.0-py3-none-any.whl (22.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: tkstart-1.0.0.tar.gz
  • Upload date:
  • Size: 23.7 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.0.tar.gz
Algorithm Hash digest
SHA256 f460aba4462cf24760c45562a0dc7ba2b67647621f083c3124fc1db58d9b4681
MD5 49c8b0edcf3a7aece23cf4db6b06ad77
BLAKE2b-256 8786fbe8286b772579f9bf63287e76bce33a6668ad518547922b52322aa357d1

See more details on using hashes here.

File details

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

File metadata

  • Download URL: tkstart-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 22.8 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.0-py3-none-any.whl
Algorithm Hash digest
SHA256 c508d7adb776ef050869c6e3b8180caf64fbbefed99eec9d012543a925f52a45
MD5 ece5a449f84899999f079d03278ce071
BLAKE2b-256 e49a7d5960968976f040bd8b55b82af485bb07166e99e31257f3d71873861ecf

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