Pyrustic
Pyrustic Framework is a lightweight framework to develop, package, and publish Python desktop applications.
Installation | Tutorial | Guide | Reference | Website
Table Of Contents
Overview
Python is one of the world's most popular programming languages. It's used in many application domains from machine learning to web development. Desktop application development is exciting. Pyrustic Framework aims to help you build great desktop apps.
Batteries included
Pyrustic Framework comes with batteries included:
- Backstage: a project manager command-line tool that allows you to initialize a project directory with a structure as described in the Python Packaging User Guide, perform
versioning,builda distribution package,publishthe distribution package, and more. This tool comes with a nicehookingmechanism and anAPIso you could easily automate your workflow withPythoncode. - Viewable: subclass it to implement a view with a transparent
lifecyclemechanism that will make it easier to build and maintain yourGUI. - Megawidget: a set of useful megawidgets like
Table,Scrollbox,Toast,Treeand more. - TkStyle: a library to make it easy for you to create your own
stylesandthemes. - Cyberpunk-theme: give a modern look to your desktop app with this
dark theme. Theme built withTkStyle. - Winter-theme: give a modern look to your desktop app with this
light theme. Coming soon ! - Threadom: it is well known how difficult it is to implement
multithreadingin aTkinterapplication.Threadomis a library to make it easy to develop multithreading applications. You can retrieve from the main thread the values returned and the exceptions raised by the functions executed in other threads. - Shared: library to store, expose, read, and edit
collectionsof data. - Diaspora: as a software grows, so is its complexity.
Diasporaallows loosely coupled components to exchange data, subscribe to events and publish events notifications. - Jayson: intuitive interaction with JSON files. With
Jayson, you can initialize preferences/configuration/whateverJSONfiles easily, thanks to its internal mechanism that creates a fresh copy of the given defaultJSONfile at the target path.Jaysonalso comes with a lock to openJSONfiles in readonly mode. - Kurl:
libraryto fetch resources with an implementation of conditional request and a smart responses caching system. - Litedao:
libraryto simplify the connection to your SQLite database with some cool features like the ability to specify what I call acreational scriptthat will be used to create a new database when it is missing.
As you can see, the framework covers various topics, from GUI to database connection, and it enforces good practices like the project structure by example.
Examples
This is the typical content of __main__.py:
Click to expand (or collapse)
from pyrustic.app import App
from cyberpunk_theme import Cyberpunk
# the framework comes with a graphical 'Hello World' view
from pyrustic.hello import HelloView
def main():
# The App
app = App()
# Set the theme
app.theme = Cyberpunk()
# Set the main view (it could be a plain old Tkinter object)
app.view = HelloView(app)
# Center the window
app.center()
# Lift off !
app.start()
if __name__ == "__main__":
main()This is an example of a view definition:
Click to expand (or collapse)
import tkinter as tk
from viewable import Viewable
class View(Viewable):
def __init__(self, master):
super().__init__()
self._master = master
def _build(self):
self._body = tk.Frame(self._master)
label = tk.Label(self._body, text="Hello !")
label.pack()
def _on_map(self):
""" This method is called when the view is mapped for the first time """
def _on_destroy(self):
""" This method is called when the view is destroyed """
if __name__ == "__main__":
root = tk.Tk()
view = View(root)
# the method build_pack() builds then packs the view.
# In fact you could do:
# view.build() then view.pack()
# or:
# view.build() then view.body.pack()
view.build_pack() # it accepts arguments like the Tkinter pack() method
root.mainloop()
This is an example of a naked view (a view that doesn't subclass Viewable):
Click to expand (or collapse)
import tkinter as tk
from pyrustic.app import App
from cyberpunk_theme import Cyberpunk
def view(app):
""" A Naked View is a function that accepts the app reference as argument
and returns a Tkinter object (generally a container like tk.Frame) """
master = app.root
# The body of this naked view is a tk.Frame
body = tk.Frame(master)
label = tk.Label(body, text="Hello !")
label.pack()
return body # mandatory !
if __name__ == "__main__":
app = App()
app.theme = Cyberpunk()
app.view = view # Naked view reference
app.start()
Installation
Requirements
Pyrustic Framework is cross platform and versions under 1.0.0 will be considered Beta at best. It is built on Ubuntu with Python 3.8 and should work on Python 3.5.
As Pyrustic Framework is built with Python for Python developers you may need to learn Python and Tkinter.
First time
Install for the first time:
$ pip install pyrusticUpgrade
To upgrade Pyrustic Framework:
$ pip install pyrustic --upgrade --upgrade-strategy eagerI recommend upgrading Pyrustic Framework with the eager upgrade strategy as specified since the project is under active development.
Documentation
FAQ
Read the FAQ.
Tutorial
Read the Tutorial.
Guide
Read the Guide.
Glossary
Read the Glossary.
Reference
Read the Reference.
External Learning Resources
Some interesting links below to get started with Python, Tkinter and SQLite.
Introduction to Python
- python-guide
- python tutorial
- freeCodeCamp on Youtube
Introduction to Tkinter
- tkdocs
- tkinter tutorial
- freeCodeCamp on Youtube
Introduction to SQLite
- sqlitetutorial
- freeCodeCamp on Youtube
Note: I am not affiliated with any of these entities. A simple web search brings them up.
Linked Projects
Pyrustic Framework is part of the Open Pyrustic Ecosystem. Let's discover some other ecosystem projects.
Hubstore
Once you have published your app to Github with the command publish in the Project Manager, the next question that arises is: "How to make the find-download-install-run process easier for users ?". This is where Hubstore comes in.
With Hubstore, it's easy to showcase, distribute, install, and manage your Python desktop apps.
Note that any Python Wheel app is compatible with Hubstore, in others words, you don't need to use the Pyrustic Framework to have a Hubstore compatible app.
Hubstore itself is built with Pyrustic Framework and is available on PyPI.
Do you want to learn more about Hubstore ? Discover Hubstore !
Dresscode
If Pyrustic Framework is C, Dresscode would be Python.
Dresscode is a high productivity framework for developing a graphical user interface without prior knowledge of using a GUI Toolkit.
As a high productivity framework, Dresscode is suitable for teaching, prototyping, testing, adding a GUI to command-line scripts, developing simple to complex desktop applications, etc.
Under the hood, Dresscode uses Pyrustic Framework.
Discover Dresscode !
Desktop apps built with Pyrustic Framework
Here are some desktop apps built with Pyrustic Framework
License
Pyrustic Framework is licensed under the terms of the permissive free software license MIT License.
Contact
Hi ! I'm Alex, operating by "Crocker's Rules"





