Skip to main content

An xml based GUI framework with property binding and dependency injection.

Project description

Documentation Status

guiml

A simple to use GUI framework for python. You define what you want and the framework does the rest. You build the UI out of components that are defined using XML as markup language. The markup language allows you to interact with your python code via variable binding, callbacks and the use of control flow primitives. To help you with organizing your application, the framework allows you to nicely compose components and comes with automated dependency injection. (You know vue.js or angular from web development? Something like that.)

Ever wondered why so many GUIs nowadays seem to be written with a HTTP/CSS/JS front end, even for desktop (e.g. via electron)? How is that the easiest way of designing modern GUIs? Some things in web front end development are nice and shiny, like live inspection and editing of styles, reactive variable bindings, defining components and the UI in a nice markup language, allow control flow in the markup language, have automatic dependency injection...

Can't we have all these nice things but in python? And without the hassle of a client-server architecture and java script?

This project is a case study where I try to figure out and build the GUI framework that I would want to use. To not have to deal with legacy issues of other GUI frameworks, this project starts quite low level using pyglet as window engine and to deal with IO, cairo for drawing and pango for text setting and librsvg for svg drawing. Everything else is build from scratch.

Current state

The current state is a proof of concept. It should work on the examples, but is other wise terribly tested, barely documented and probably throws non-sensical error messages at you when you do something wrong. The API is unstable.

Dokumentation

The dokumentation and a small tutorial can be found at guiml.readthedocs.io.

Installation

Step 1) Install non Python Dependencies

Debian/ Ubuntu / Windows with WSL2 + Debian

Install external requirenments (to access librsvg, cairo, pango from python)

sudo apt install libgirepository2.0-dev librsvg2-dev libcairo2-dev python3-gi-cairo

If you run into problems with installing the dependencies, you can check out the links in the Other section below.

Other (Windows Native / Mac / Other Linux Distributions)

For Windows it is recommended to use Debian on WSL2 (Instructions) once on the Debian command line you can follow the normal Debian instructions for installing this package.

If you are not on a debian derivate, then installation should in principle be possible if you are sufficiently brave and smart, but you will have to figure it out yourself. Here are some links to the dependencies that might be helpfull.

You will need pygobject with cairo and librsvg.

Check how to install cairocffi and pangocffi on their respective sites.

Step 2a) Installation from source

It is recommended to use the latest version of pip and setuptools.

pip install -U pip setuptools

You can install the project from source via

git clone https://github.com/StephanGocht/guiml.git
cd guiml
pip install -e .

After installation (or just installing the packages from requirements.txt) you can run the examples from the guiml folder to confirm everything is working. For the todo list example run

python3 -m examples.todolist

To update to the latest version, run

git pull

Step 2b) Installation from PyPi

pip install guiml

Misc

License

You can use find . -name LICENSE to collect all used licenses. The license applies to all files in the contained directory or subdirectories.(Except for directories that have their own LICENSE). Which should currently be as follows.

./LICENSE (MIT)
./guimlcomponents/base/cairocffi_to_pycairo/LICENSE (BSD-3)
./examples/todolist/resources/material-design-icons/LICENSE (Apache-2)

Examples are not included in builds.

Related Work

You can find more boradly used GUI frameworks on awesome-python.

See also:

collgraph

Write your Python interfaces in a declarative manner with plain render functions, component classes or even single-file components using Vue-like syntax, but with Python!

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

guiml-0.2.0.tar.gz (63.2 kB view details)

Uploaded Source

Built Distribution

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

guiml-0.2.0-py3-none-any.whl (32.0 kB view details)

Uploaded Python 3

File details

Details for the file guiml-0.2.0.tar.gz.

File metadata

  • Download URL: guiml-0.2.0.tar.gz
  • Upload date:
  • Size: 63.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.19

File hashes

Hashes for guiml-0.2.0.tar.gz
Algorithm Hash digest
SHA256 adeea5050962737766f731817bc212347ad82f728ae635de35571d6183a8b732
MD5 aa86929ea694f2983bb5df3676bba90b
BLAKE2b-256 b8214a47d0232b00012fbdbd9bd4152098d6f601146456bb85220b9acf3ade2f

See more details on using hashes here.

File details

Details for the file guiml-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: guiml-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 32.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.8.19

File hashes

Hashes for guiml-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d2ea534c653dadd3c67ef0b5b8f6f1d57dbfc450f1e50ca238f6173e17beade8
MD5 b1c6285b6996d6dd41531dfb768d1112
BLAKE2b-256 e5b7343074a8171bc590fc0acac52dbb4d873c616a40973623163c26788a10cc

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