Skip to main content

Python + HTML desktop app framework

Project description

Pype

logo

Fast and Simple GUI framework for Python

Render Python computed values and interact them via HTML in a webview application

Good for fast visualization or lightweight applications

The application The backend The frontend
The application The backend The frontend

Documentation

Project creation

Generates the project with all needed files.

Project-Name
├── frontend - HTML, CSS, Pype frontend library.
│ └── assets - Any asset file.
└── app.py

plumber new project-name

Project build

Generates an .exe executable file from the given project. The project should follow the generated structure.

plumber build project-name

Expose

Description:
Exposes a function to the frontend side to be called

Example:

app.expose(functionFromPython)

Call

Description:
Calls an exposed function from the frontend

Example:

onclick="call('functionFromPython')"

State Management

Push

Applies and finalizes state changes by triggering observers and hooks. Updates are batched for efficiency, ensuring cleaner and more controlled state management. It offers on-demand state updates, reducing unnecessary processing.

Python:

app.state["numbers"].append(value)
        
app.push(["numbers","some other key","...another"]) #finalizes state change

JavaScript:

onclick="state['count']++; push(['count'])"

Pull

Gets a state values deep copied value, for other usage then just immidietly setting state.

Python:

app.pull("count")

JavaScript:

onclick="alert(pull('count'))"

Binds

Description:
Binds a state to an element via its key attribute and specifies which attribute should be updated upon a state change.

Example:

app.bind('state-key', 'element-key', HTMLAttributes.INNERHTML)

Hooks

Description:
Attaches a function to a specific state change. When the state updates, the hooked function is called.

Example:

app.hook('state-key', hooked_function)

Prefabs

Creation

Description:
Users can create prefabs that can be instantiated or destroyed by the app. Attributes are passed as Python dictionaries.

Example (HTML):

<prefab id="prefab-name">
    <div class="number" style="color: $attribute-name-2; border-color: $attribute-name-2;">$attribute-name</div>
</prefab>

Instantiate

Description:
Instantiates a prefab with a unique key under a specified parent element, passing attributes to customize its content.

Example:

app.instantiate("prefab-name", f"key-prefix-{count}", "prefab-parent-id", {"attribute1": 'something', "attribute2": 0})

Destroy

Description:
Destroys a prefab with the specified ID and key. During destruction, the prefab enters its destruction phase and receives the .destroyed class for exit animations.

Example:

app.destroy("prefab-name", f"key-prefix-{prevCount}")

Observer

Description:
Observes a state array that contains attributes for prefabs, upon its change automatically instantiates or destroys prefabs.

Example:

app.observe('state-key','prefab-id','key-prefix','prefab-parent-id')

Load Page

Description:
Loads a given page exposed to the run function. .unloaded class for the current page for exit animations.

Example:

app.run([updatingFunc],["index.html","new-page.html"]) #Expose pages to app

app.load_page(1)

Custom Window Handle

Description:
All pages has a .window-handle div at top. This area is customizable too for making it fit with your app.

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

pype_framework-1.0.6.tar.gz (42.4 kB view details)

Uploaded Source

Built Distribution

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

pype_framework-1.0.6-py3-none-any.whl (40.8 kB view details)

Uploaded Python 3

File details

Details for the file pype_framework-1.0.6.tar.gz.

File metadata

  • Download URL: pype_framework-1.0.6.tar.gz
  • Upload date:
  • Size: 42.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.6

File hashes

Hashes for pype_framework-1.0.6.tar.gz
Algorithm Hash digest
SHA256 d7f0a9a739c87cefde13f10e1a5ddebd569a16055541cedaf973ccb036b0c6c7
MD5 0f90f132f0b9e3f200f25264baca3a60
BLAKE2b-256 7d2cda33fd03ab76fd29ac621e75b5b92fcfe60fc8d783b467f8f318cf4ea454

See more details on using hashes here.

File details

Details for the file pype_framework-1.0.6-py3-none-any.whl.

File metadata

  • Download URL: pype_framework-1.0.6-py3-none-any.whl
  • Upload date:
  • Size: 40.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.10.6

File hashes

Hashes for pype_framework-1.0.6-py3-none-any.whl
Algorithm Hash digest
SHA256 f9c4fa5d81250d5d05d42daaddf434b789cb50c74bcd8d9acf0973bc0a91153d
MD5 1b7f2fe295de7e094db0846ea65829d3
BLAKE2b-256 6b0ef9b76548144b741dd191b88765255f7576faac58864e95abb43463cd3a13

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