Skip to main content

Gempyre is a framework for quick and simple UI development

Project description

Gempyre-Python

The easy and productive UI library for Python.

Gempyre

Gempyre is a C++ GUI library, see https://github.com/mmertama/Gempyre.git.

install from PyPi

pip install Gempyre

Build from sources

Create a venv (https://docs.python.org/3/library/venv.html)

  pip install .

Notes:

Raspberry OS

Todo: Needs optional RASPEBERRY flag to be passed to CMake.

Missing libraries

You may need python3-dev and python3-pip be installed. This may depend on your evironment, In linux e.g. apt-get install python3-dev, in MacOS look brew.

Windows:

# Windows has a limit of path lengths to 260 chars - 8-+ 
#   
#   "260 characters is enough for everybody"
#                 - W.G III

That may cause troubles (especially with python -m build).

Run

After install, you just run the script!

$ python3 test/telex_test.py

API

See examples how to use e.g. telex_test

The programming interface is very same as in Gempyre

  • except I changed function and method name naming from CamelCase to more pythonic snake_case (Im not sure if that was a right choice).

Please look Gempyre for documentation.

Please note that Gempyre Core and Gempyre Graphics are part of Python API, but not Gempyre-Utils, it has C++ utilites and thus not applicable for Python programmers as everything and more is already there!

Examples

Minimum single file app

#!/usr/bin/python3
import Gempyre
import os
import sys
from Gempyre import resource

html = '''
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
  <meta http-equiv="Pragma" content="no-cache" />
  <meta http-equiv="Expires" content="0" />
</head>
<body>
  <script src="/gempyre.js"></script>
  Hello!
</body>
</html>  
'''


if __name__ == "__main__":
    map, names = resource.from_bytes({"ui.html": bytes(html, 'utf-8')})
    ui = Gempyre.Ui(map, names["ui.html"])
    ui.run()
    

Minimum application with an external UI file

import Gempyre
import os
import sys
from Gempyre import resource

name = os.path.join(os.path.dirname(sys.argv[0]), "hello.html")
map, names = resource.from_file(name)
ui = Gempyre.Ui(map, names[name])
ui.run()

HTML

Assumed to be found in the same folder as the script

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
  </head>
  <body>
    <script src="/gempyre.js"></script>
    Hello!
  </body>
</html>

Application with interaction

Python

def main():
    name = os.path.join(os.path.dirname(sys.argv[0]), "example2.html")
    map, names = resource.from_file(name)
    ui = Gempyre.Ui(map, names[name])
    output = Gempyre.Element(ui, "output")
    open_button = Gempyre.Element(ui, "open")
    open_button.subscribe("click", lambda _: output.set_html("Hello"))
    ui.run()

if __name__ == "__main__":
    main()

HTML

<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>test</title>
  </head>
  <body>
    <script src="/gempyre.js"></script>
    <button id="open">Open</button>
    <pre id="output"></pre>
  </body>
</html>

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

Gempyre-1.2.26.tar.gz (48.8 kB view details)

Uploaded Source

Built Distributions

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

Gempyre-1.2.26-cp310-cp310-win_amd64.whl (550.3 kB view details)

Uploaded CPython 3.10Windows x86-64

Gempyre-1.2.26-cp310-cp310-macosx_12_0_x86_64.whl (642.8 kB view details)

Uploaded CPython 3.10macOS 12.0+ x86-64

Gempyre-1.2.26-cp38-cp38-win_amd64.whl (550.2 kB view details)

Uploaded CPython 3.8Windows x86-64

Gempyre-1.2.26-cp38-cp38-macosx_12_0_x86_64.whl (642.7 kB view details)

Uploaded CPython 3.8macOS 12.0+ x86-64

File details

Details for the file Gempyre-1.2.26.tar.gz.

File metadata

  • Download URL: Gempyre-1.2.26.tar.gz
  • Upload date:
  • Size: 48.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for Gempyre-1.2.26.tar.gz
Algorithm Hash digest
SHA256 b77eff666bd93736d1c8599b548a028c3a2246dd34b9ec0bcd03546e84657270
MD5 5783705f1a9fd32589b549ae691cc915
BLAKE2b-256 c4cc1fe066d8f471bd6594fc81e306eb835d48e3d3b7ad9d21559e6812782bc2

See more details on using hashes here.

File details

Details for the file Gempyre-1.2.26-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: Gempyre-1.2.26-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 550.3 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for Gempyre-1.2.26-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 13c26e2b507d4b45ae2d8f1e209a9a8e0d170e4ad1f37bd41a0acf329a6be964
MD5 b7c9a3d284fad722e88e3809170be821
BLAKE2b-256 843d119237a8c4f98b6b6cf4d147b9c329dad732537b4d9786adffbaa72b4048

See more details on using hashes here.

File details

Details for the file Gempyre-1.2.26-cp310-cp310-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for Gempyre-1.2.26-cp310-cp310-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 a631e0286ab2dedbc1a95ca2695ea30800059bbe48e7cd9bbd9514cae3284848
MD5 d49ace752abf93bd38b960c4607eca68
BLAKE2b-256 47e7f68693f79eab651f54a90938c3e2d0350fd9a89a380ddb00d8caf0b728e2

See more details on using hashes here.

File details

Details for the file Gempyre-1.2.26-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: Gempyre-1.2.26-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 550.2 kB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for Gempyre-1.2.26-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 f5a60bcdc358ba0d51a6c00d2a31bb464eb68b5684f59f2cd83822e88e86d7f0
MD5 16991893b2db99f61cb1dd24ebd215d3
BLAKE2b-256 0ef2b5bf7470f4cda83ed8d0b95b9cf5df5f28bbcccd15194d58d8c9f19ea3ea

See more details on using hashes here.

File details

Details for the file Gempyre-1.2.26-cp38-cp38-macosx_12_0_x86_64.whl.

File metadata

File hashes

Hashes for Gempyre-1.2.26-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm Hash digest
SHA256 460f2aa61719d19ddfebae62e763d3246d88a4689fc34a881027109031f06b44
MD5 516257135ad05eebd58da317e4fe1e9f
BLAKE2b-256 b705ffb4fd0f5702dae5ce8c437a8cc083fcab5e9844d263f5394148787ede84

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