Skip to main content

Code-generator for building small desktop applications with Python and Tkinter

Project description

kkAppKit

Framework for building small desktop tools with Python and Tkinter

Intentions

This project aims to simplify building:

  • Small desktop tools
  • Prototypes, demos, and tutorials

Target Users

  • Scientists and engineers
  • Technical artists

Benefits for End-Users

  • Easy to add GUI frontend to command-line programs, and release them as standalone apps
  • Simple and consistent layout: All tools made by this kit use single-page and endless-vertical-scroll paradigms
  • Supports both CLI and GUI
  • Supports important common app features out of the box, such as reset-to-default, presets and context help

Benefits for Developers

  • Almost no frontend code to write, thanks to its declarative JSON configuration that drives code generation
  • Decouples frontend-backend developement using the Model-View-Controller architecture
  • CI/CD friendly: ready-to-use build scripts for testing, building, and packaging in the generated app
  • Lightweight: The GUI code only depends on small wrapper packages around Python 3 and Tkinter

How to install kkappkit?

  • Clone this repo
  • POSIX: cd kkappkit && sudo ln -s $(pwd)/kkappgen /usr/local/bin/; ensure /usr/local/bin is under your system $PATH
  • Windows: cd kkappkit && mklink a\folder\under\your\system\%PATH%\kkappgen.bat .\kkappgen\kkappgen.bat

How to work with kkappkit?

  • Initialize a new app project: kkappgen -r /path/to/my_app_root -t <template_name>
    • This generates a Poetry project with a template app
    • Look for template name under res/template/*.app.json; the firstname of the template file is the template name
  • Edit pyproject.toml and install dependencies: cd /path/to/my_app_root && poetry install
  • Design the app parameter interface by editing the initialized configuration file, e.g., src/app.json
  • Generate the interface (CLI/GUI) code: kkappgen -r /path/to/my_app_root
  • Implement the core and hooks as a CLI or GUI or both
  • Run the CLI or GUI using: run or gui
  • Optionally, dev builds a standalone app bundle for distribution based on the configuration
  • See demo folder for examples

Why not use a full-fledged framework like PySide, PyGTK, or Electron?

  • Most of them are too heavy for small tools, complicating CI and distribution; TkInter as the first-party GUI lib simplifies distribution
  • Those frameworks aim at breadth and come with a steep learning curve (opinions); I want to bake in just enough policies for RAD without making the kit too opinionated

How to run the demos?

The guides below assume:

  • You are a POSIX developer; Windows developers should be able to adapt the steps accordingly
  • You have cloned and installed kkappkit
  • You have poetry on your system

The demos must be built before running:

  • The demo assets are located under demo folder.
  • character is a form-filling demo
  • oscillator is a controller demo

Next, we'll introduce each demo.

Charater

# create a new skeleton, use -f to force-overwrite existing files 
cd /path/to/kkappkit
kkappgen -r /path/to/character -t template

# navigate to the generated app  
cd /path/to/character
#
# edit pyproject.toml to add dependencies
# 
# then install dependencies
rm poetry.lock &> /dev/null
poetry install

# manually edit the configuration file (src/app.json) to fill in app metadata and input/output
# and generate the interface code
# overwrite the default assets with demo implementation
kkappgen -r `pwd` -i /path/to/kkappkit/demo/character

# run the app and play around with it
./ui

# quit the app after done
# build the standalone app for local testing 
ci/evaluate

# release as a platform-dependent installer
ci/release

Oscillator

Similart to the above steps, but the demo assets are located under demo/oscillator.

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

kkappkit-0.29.0.tar.gz (344.8 kB view details)

Uploaded Source

Built Distribution

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

kkappkit-0.29.0-py3-none-any.whl (392.1 kB view details)

Uploaded Python 3

File details

Details for the file kkappkit-0.29.0.tar.gz.

File metadata

  • Download URL: kkappkit-0.29.0.tar.gz
  • Upload date:
  • Size: 344.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.3 Darwin/24.3.0

File hashes

Hashes for kkappkit-0.29.0.tar.gz
Algorithm Hash digest
SHA256 473dfdcc4bc80916bb14b9c3f08310652cdabb630faee3111f49ea586c1a3925
MD5 891512de3fab4172dce5d44058406af8
BLAKE2b-256 af61c73d0561bd28ee0677945ea2c551c006d3ad78ddcc41dc9485b9b49c751e

See more details on using hashes here.

File details

Details for the file kkappkit-0.29.0-py3-none-any.whl.

File metadata

  • Download URL: kkappkit-0.29.0-py3-none-any.whl
  • Upload date:
  • Size: 392.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.4.0 CPython/3.11.3 Darwin/24.3.0

File hashes

Hashes for kkappkit-0.29.0-py3-none-any.whl
Algorithm Hash digest
SHA256 496ce4ed54d8011fa1dae94bc08cc29fe3e674dbc431c397ae2935558e4ff6c0
MD5 02076b873bd9b690216882734222c3a8
BLAKE2b-256 d5fbdc71253e6906319f800313aaaa566b4ae6fe9c4c54643eb6702c53cd26d0

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