{"id":21126997,"url":"https://github.com/pyrustic/gaspium","last_synced_at":"2025-07-08T23:32:42.634Z","repository":{"id":57433134,"uuid":"428760396","full_name":"pyrustic/gaspium","owner":"pyrustic","description":"Framework to build Python apps with the GASP metaphor","archived":false,"fork":false,"pushed_at":"2023-02-25T01:38:08.000Z","size":119,"stargazers_count":7,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-30T03:51:40.050Z","etag":null,"topics":["app","gasp","gui","metaphor","productivity","pyrustic","python","tkf","tkinter"],"latest_commit_sha":null,"homepage":"https://pyrustic.github.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyrustic.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-11-16T17:54:22.000Z","updated_at":"2024-08-12T20:18:07.000Z","dependencies_parsed_at":"2024-11-20T06:15:11.489Z","dependency_job_id":null,"html_url":"https://github.com/pyrustic/gaspium","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"a81e027dfaec57a24a83e25482ed5189a8cdef3f"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/pyrustic/gaspium","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fgaspium","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fgaspium/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fgaspium/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fgaspium/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyrustic","download_url":"https://codeload.github.com/pyrustic/gaspium/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyrustic%2Fgaspium/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264365823,"owners_count":23596908,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["app","gasp","gui","metaphor","productivity","pyrustic","python","tkf","tkinter"],"created_at":"2024-11-20T04:46:13.563Z","updated_at":"2025-07-08T23:32:42.401Z","avatar_url":"https://github.com/pyrustic.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003c!-- Cover --\u003e\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/pyrustic/misc/master/assets/gaspium/cover.png\" alt=\"Demo\" width=\"920\"\u003e\n    \u003cp align=\"center\"\u003e\n    \u003ci\u003e \u003c/i\u003e\n    \u003c/p\u003e\n\u003c/div\u003e\n\n# Gaspium\n**Framework to build Python apps with the GASP metaphor**\n\nThis project is part of the [Pyrustic Open Ecosystem](https://pyrustic.github.io).\n\u003e [Installation](#installation) . [Demo](#demo) . [Latest](https://github.com/pyrustic/gaspium/tags) . [Documentation](https://github.com/pyrustic/gaspium/tree/master/docs/modules#readme)\n\n## Table of contents\n- [Overview](#overview)\n- [App](#app)\n- [Page](#page)\n- [Command line aware](#command-line-aware)\n- [Batteries included](#batteries-included)\n- [Installation](#installation)\n- [Demo](#demo) \n\n# Overview\n**Gaspium** is a framework that allows you to create applications with the **GASP** (**G**UI **A**s **S**tapled **P**ages) metaphor. \n\nIn short, we define **pages** to which we add graphical **components**. Then we add these **pages** to an instance of the **App** class. The first **page** added is de facto the **home page** and it will be open when the application is started. Adding a **page** makes it automatically referenced in the application's **navigation bar**. You can open an arbitrary **page** of your application directly from the **command line**.\n\n**Gaspium** serves as the reference implementation of the **GASP concept**. \n\n**Discover the [GASP concept](https://github.com/pyrustic/gaspium/blob/master/gasp.md) !**\n\n# App\n\nIt is the main class of the Framework. An instance of the App class represents the running application. It is to this instance that the developer adds Pages.\n\n```python\nfrom gaspium import App\n\n\napp = App()\n\n# ...\n# Here you add pages to the app\n# The first page is considered the home page\n# ...\n\n# The last line starts the app (mainloop)\n# The home page will open automatically\napp.start()\n```\nThe `App` class accepts arguments like the theme to use, the geometry of the window, whether the caching should be enabled or not, et cetera. The `App` class also has the `add` method to add a page to the application, `open` method to open a page, `start` method to start the application, `exit` method to exit the application, et cetera.\n\n\u003e **Read the App [documentation](https://github.com/pyrustic/gaspium/blob/master/docs/modules/content/gaspium.app/content/classes/App.md#class-app).**\n\n# Page\nA **Page** is either a function or a [Viewable](https://github.com/pyrustic/viewable) subclass. Each Page added to the App instance is either manually or automatically assigned a unique page identifier, the PID, and automatically referenced in the navigation bar. A page is rebuilt or not at each opening depending on whether the `caching` feature has been activated or not.\n\n```python\nimport tkinter as tk\nfrom viewable import Viewable\nfrom gaspium import App\n\n\ndef home_page(context):\n    \"\"\"Home Page. Must accept the dto argument\"\"\"\n    # the dto contains some useful objects\n    app = context.app\n    pid = context.pid\n    data = context.data\n    root = context.root\n    # the page function must returns the body\n    # i.e. the graphical container of the page\n    body = tk.Frame(root)\n    label = tk.Label(body, text=\"Home\")\n    label.pack()\n    return body\n\n\nclass LoginPage(Viewable):\n    \"\"\"\n    Login Page\n    \"\"\"\n\n    def __init__(self, context):\n        \"\"\"\n        The constructor must accept the dto argument\n        \"\"\"\n        super().__init__()\n        # the dto contains some useful objects\n        self._app = context.app\n        self._pid = context.pid\n        self._data = context.data\n        self._root = context.root\n        # the body of the page\n        self._body = None\n\n    def _build(self):\n        self._body = tk.Frame(self._root)\n        label = tk.Label(self._body, text=\"Login\")\n        label.pack()\n\n\ndef on_open_home(context):\n    \"\"\"\n    This on_open callback must accept a dto object\n    \"\"\"\n    # redirect to login_page\n    # instead of letting the home_page open\n    app = context.app\n    app.open(\"login\")\n\n\napp = App(caching=False)\n\n# Add home_page and bind the 'on_open_home' callback\n# to perform a custom redirection to login_page\napp.add(home_page, title=\"Home\", on_open=on_open_home)\n\n# Add login_page (it won't be referenced in the navigation bar)\napp.add(LoginPage, pid=\"login\", title=\"Login\", indexable=False)\n\n# The home page will open automatically\napp.start()\n```\n\n**Play with the [Demo](https://gist.github.com/pyrustic/79c9ee0efde8c06b7d4685f3c58b7761).**\n\n# Command line aware\n\nBy default, when you run a GASP application, the first page added to the App instance opens as the home page. It is possible to open an arbitrary page of the application from the command line. To do this, just put its PID (Page ID) as an argument on the command line. The strings entered after the identifier are considered as data to be sent to the page when it is opened.\n\n```bash\n$ my-app login \"Alex Rustic\"\n# the login page will open\n```\n\n# Batteries included\n**Gaspium** comes with a handful of useful lightweight packages.\n\n| Name | Description |\n| --- | --- |\n| [Backstage](https://github.com/pyrustic/backstage) | Extensible command line tool for managing software projects |\n|[Cyberpunk-Theme](https://github.com/pyrustic/cyberpunk-theme) | A modern `dark theme` for Python apps|\n| [Shared](https://github.com/pyrustic/shared) | Data exchange and persistence |\n| [Subrun](https://github.com/pyrustic/subrun) | Intuitive API to safely start and communicate with processes in Python |\n| [TkStyle](https://github.com/pyrustic/tkstyle) | Library to create styles and themes for Python apps |\n| [Megawidget](https://github.com/pyrustic/megawidget) | Collection of megawidgets to build graphical user interfaces for Python apps |\n| [Viewable](https://github.com/pyrustic/viewable) | Python library to implement a GUI view with lifecycle |\n| [Threadom](https://github.com/pyrustic/threadom) | Tkinter-compatible multithreading |\n| [Suggestion](https://github.com/pyrustic/suggestion) | Democratizing auto-complete(suggest) for Python desktop applications |\n| [Kurl](https://github.com/pyrustic/kurl) | Konnection URL: HTTP requests in Python with an implementation of conditional request and a responses caching system |\n\n# Installation\n**Gaspium** is **cross platform** and versions under **1.0.0** will be considered **Beta** at best. It is built on [Ubuntu](https://ubuntu.com/download/desktop) with [Python 3.8](https://www.python.org/downloads/) and should work on **Python 3.5** or **newer**.\n\n## For the first time\n\n```bash\n$ pip install gaspium\n```\n\n## Upgrade\n```bash\n$ pip install gaspium --upgrade --upgrade-strategy eager\n```\n\n\n# Demo\nA demo is available to play with as a **Github Gist**. Feel free to give a feedback in the comments section.\n\n**Play with the [Demo](https://gist.github.com/pyrustic/79c9ee0efde8c06b7d4685f3c58b7761).**\n\n\u003cbr\u003e\n\u003cbr\u003e\n\u003cbr\u003e\n\n[Back to top](#readme)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrustic%2Fgaspium","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyrustic%2Fgaspium","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyrustic%2Fgaspium/lists"}