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
There are many flavors in installing - but you need at least Python3.8 on Linux, Windows or MacOS.
e.g.
pip3 install Gempyre --user
Installs Gempyre to the current user site-packages.
See also Create a venv (https://docs.python.org/3/library/venv.html)
Build from sources
You can clone the repository and do install, or get releases from repository.
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
Windows default filepath length is an issue. See Here and Here (reboot after change)
If that does not help (or not an option) you may try say in powershell.
mkdir C:\f
$env:TMPDIR = "C:\f"
$env:TEMP = "C:\f"
...before pip install.
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
See small test apps
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for Gempyre-1.3.6-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86c44f72ee3b0cb963a59f33c2232f8afb06f1c4191330bd5a9453055788034b |
|
MD5 | 820b1e78ebdb6424bad67bfcb1eb5242 |
|
BLAKE2b-256 | 4d32c7c1e293771e8b344062a3e00ba251eb9646494e4b8add1dcf2da08dc196 |
Hashes for Gempyre-1.3.6-cp38-cp38-macosx_12_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b096a69f8673c41c947d282a1b989bc039f4434c19ce3344a21eba222dedfcbd |
|
MD5 | 70e2148ac4f627b323f0ff41d5d47bf8 |
|
BLAKE2b-256 | 96c23bec3fbf11a4148690f06fbb0728d3e89c38f6d476c5aa66ddc406b6654d |