Applepy is a UI library inspired by Swift UI that leverages AppKit and UIKit (soon) to create native MacOS, iOS and iPadOS user interfaces in the Python programming language with a declarative syntax.
Project description
applepy
Applepy is a UI library inspired by Swift UI that leverages AppKit and UIKit to create native MacOS, iOS and iPadOS user interfaces in the Python programming language with a declarative syntax.
This project is at proof of concept stage and is not feature complete. Please do not use it in production.
Dependencies
Installation
The latest version is available for installation in PyPI:
pip install applepy-ui
Usage
class Sample(App):
def body(self) -> Scene:
with Window(title='Applepy example', size=Size(640, 100)) as w:
with VerticalStack():
with HorizontalStack():
Label(text='Hello')
Label(text='World')
return w.center()
Sample().run()
It also works on mobile:
class MobileSample(App):
def body(self):
with SimpleScreen() as s:
with HorizontalStack():
with VerticalStack():
Label(text='Hello World')
return s
def main():
sys.exit(MobileSample().run())
Events can be handled synchronously and asynchronously in the same context:
class AsyncSample(App):
def clicked(self) -> None:
time.sleep(2)
Alert.show_info(informative_text='Hello', message_text='Synchronous World')
async def clicked_async(self) -> None:
await asyncio.sleep(2)
Alert.show_info(informative_text='Hello', message_text='Asynchronous World')
def body(self) -> Scene:
with Window(title='Applepy async example', size=Size(640,480)) as w:
with HorizontalStack():
with VerticalStack():
Button(title='Sync action', action=self.clicked)
Button(title='Async action', action=self.clicked_async)
return w.center()
AsyncSample().run_async()
For a more complete example, please check example.py
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
Built Distribution
File details
Details for the file applepy-ui-0.0.5.tar.gz
.
File metadata
- Download URL: applepy-ui-0.0.5.tar.gz
- Upload date:
- Size: 38.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43ee056af28ea1cd59d9a5bebcf44e975281d1ef6f2f16f8b2c5c02fda9b9b97 |
|
MD5 | 8041a716fa269e4341bcd867e47e94da |
|
BLAKE2b-256 | a90cf0caf3ca08cdb7c2c25d9ba5393e90d018b6b9797c06ffef44988104119c |
File details
Details for the file applepy_ui-0.0.5-py3-none-any.whl
.
File metadata
- Download URL: applepy_ui-0.0.5-py3-none-any.whl
- Upload date:
- Size: 49.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.9.13
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1dab8d5f5e24715af0b63a4c8fd7eb44d869800d4f7a4b22a889d128e170128 |
|
MD5 | 2cdd567d038c7744ef4e346f997508be |
|
BLAKE2b-256 | f06309db224db50f56c681b5f634295dfa372becf28b10b651d0699053372c9c |