Framework for console GUI apps
## Установка
Установить через pip:
```bash
pip install FloriaConsoleGUI --upgrade
```
Или скачать исходный код из [PyPi](https://pypi.org/project/FloriaConsoleGUI/)
## Использование
Рекомендуется писать код только в самом python
### Пример обычного использования:
`main.py`:
```python
from random import random as rdf
from FloriaConsoleGUI import *
from FloriaConsoleGUI.Graphic.Widgets import *
from FloriaConsoleGUI.Graphic.Windows import *
from FloriaConsoleGUI.Managers import *
@Core.init_all_event.dec
def init():
WindowManager.openNewWindow(
TitledWindow(
size=(20, 10),
frame=True,
title=' Example ',
widgets=[
Label(
text='hello world!',
name='label'
)
]
)
)
@Core.SimulationThread.sim_event.dec
def simulation():
label: Label = Widget.getByName('label')
if label is not None:
label.text = f'{rdf():.4f}'
if __name__ == '__main__':
Core.init()
Core.start()
Core.term()
```
Однако, для удобства есть динамическое обновление:
- .json - для древа
- .py - для скриптов (не рекомендуется из-за специфики реализации)
Не обязательно использовать сразу оба
### Пример с динамическим обновлением:
`main.py`:
```python
from FloriaConsoleGUI import *
from FloriaConsoleGUI.Managers import Parser
@Core.init_all_event.dec
def init():
Core.addDynamicModule('dyn.py', 'dyn')
Parser.setFile('./dyn.json')
@Core.SimulationThread.sim_event.dec
def simulation():
Core.checkDynamicModules()
Parser.checkUpdate()
if __name__ == '__main__':
Core.init()
Core.start()
Core.term()
```
`dyn.py`:
```python
from random import random as rdf
from FloriaConsoleGUI import *
from FloriaConsoleGUI.Graphic.Widgets import *
@Core.SimulationThread.sim_event.dec
def simulation():
label: Label = Widget.getByName('label')
if label is not None:
label.text = f'{rdf():.4f}'
```
`dyn.json`:
```json
[
{
"class": "TitledWindow",
"size": [20, 10],
"frame": true,
"title": " Example ",
"widgets": [
{
"class": "Label",
"name": "label",
"text": "hello world!"
}
]
}
]
```
### Результат:
![example window](https://github.com/FloriaProduction/FloriaConsoleGUI.github.io/blob/main/static/images/Example.png?raw=true)
## Документация
На данный момент [документация](https://FloriaConsoleGUI.github.io) разрабатывается...
Raw data
{
"_id": null,
"home_page": null,
"name": "FloriaConsoleGUI",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "python console gui ui ux",
"author": "FloriaProduction",
"author_email": "FloriaProduction@yandex.ru",
"download_url": "https://files.pythonhosted.org/packages/b6/f1/3d91a52497fbc0d3e67abe859ac2b60ecdecfcc86d7f86543f89ea0f01c3/FloriaConsoleGUI-1.1.1.tar.gz",
"platform": null,
"description": "Framework for console GUI apps\r\n\r\n## \u0423\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u0430\r\n\r\n\u0423\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u044c \u0447\u0435\u0440\u0435\u0437 pip:\r\n\r\n```bash \r\npip install FloriaConsoleGUI --upgrade\r\n```\r\n\r\n\u0418\u043b\u0438 \u0441\u043a\u0430\u0447\u0430\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u0438\u0437 [PyPi](https://pypi.org/project/FloriaConsoleGUI/)\r\n\r\n## \u0418\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435\r\n\r\n\u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u0441\u0430\u043c\u043e\u043c python\r\n\r\n### \u041f\u0440\u0438\u043c\u0435\u0440 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f:\r\n\r\n`main.py`:\r\n\r\n```python\r\nfrom random import random as rdf\r\n\r\nfrom FloriaConsoleGUI import *\r\nfrom FloriaConsoleGUI.Graphic.Widgets import *\r\nfrom FloriaConsoleGUI.Graphic.Windows import *\r\nfrom FloriaConsoleGUI.Managers import *\r\n\r\n@Core.init_all_event.dec\r\ndef init():\r\n WindowManager.openNewWindow(\r\n TitledWindow(\r\n size=(20, 10),\r\n frame=True,\r\n title=' Example ',\r\n \r\n widgets=[\r\n Label(\r\n text='hello world!',\r\n name='label'\r\n )\r\n ]\r\n )\r\n )\r\n\r\n@Core.SimulationThread.sim_event.dec\r\ndef simulation():\r\n label: Label = Widget.getByName('label')\r\n if label is not None:\r\n label.text = f'{rdf():.4f}'\r\n\r\n\r\nif __name__ == '__main__': \r\n Core.init()\r\n Core.start()\r\n Core.term()\r\n```\r\n\r\n\u041e\u0434\u043d\u0430\u043a\u043e, \u0434\u043b\u044f \u0443\u0434\u043e\u0431\u0441\u0442\u0432\u0430 \u0435\u0441\u0442\u044c \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435:\r\n- .json - \u0434\u043b\u044f \u0434\u0440\u0435\u0432\u0430\r\n- .py - \u0434\u043b\u044f \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 (\u043d\u0435 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u0442\u0441\u044f \u0438\u0437-\u0437\u0430 \u0441\u043f\u0435\u0446\u0438\u0444\u0438\u043a\u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438)\r\n\r\n\u041d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043e\u0431\u0430\r\n\r\n### \u041f\u0440\u0438\u043c\u0435\u0440 \u0441 \u0434\u0438\u043d\u0430\u043c\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u0435\u043c:\r\n\r\n`main.py`:\r\n\r\n```python\r\nfrom FloriaConsoleGUI import *\r\nfrom FloriaConsoleGUI.Managers import Parser\r\n\r\n\r\n@Core.init_all_event.dec\r\ndef init():\r\n Core.addDynamicModule('dyn.py', 'dyn')\r\n Parser.setFile('./dyn.json')\r\n\r\n@Core.SimulationThread.sim_event.dec\r\ndef simulation():\r\n Core.checkDynamicModules()\r\n Parser.checkUpdate() \r\n\r\n\r\nif __name__ == '__main__': \r\n Core.init()\r\n Core.start()\r\n Core.term()\r\n```\r\n\r\n`dyn.py`:\r\n\r\n```python\r\nfrom random import random as rdf\r\n\r\nfrom FloriaConsoleGUI import *\r\nfrom FloriaConsoleGUI.Graphic.Widgets import *\r\n\r\n\r\n@Core.SimulationThread.sim_event.dec\r\ndef simulation():\r\n label: Label = Widget.getByName('label')\r\n if label is not None:\r\n label.text = f'{rdf():.4f}'\r\n```\r\n\r\n`dyn.json`:\r\n\r\n```json\r\n[\r\n {\r\n \"class\": \"TitledWindow\",\r\n \r\n \"size\": [20, 10],\r\n \"frame\": true,\r\n \"title\": \" Example \",\r\n\r\n \"widgets\": [\r\n {\r\n \"class\": \"Label\",\r\n \"name\": \"label\",\r\n\r\n \"text\": \"hello world!\"\r\n }\r\n ]\r\n }\r\n]\r\n```\r\n\r\n### \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442:\r\n\r\n![example window](https://github.com/FloriaProduction/FloriaConsoleGUI.github.io/blob/main/static/images/Example.png?raw=true)\r\n\r\n## \u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f\r\n\r\n\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u043c\u043e\u043c\u0435\u043d\u0442 [\u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f](https://FloriaConsoleGUI.github.io) \u0440\u0430\u0437\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f...\r\n",
"bugtrack_url": null,
"license": "Apache-2.0",
"summary": "Framework for console GUI apps",
"version": "1.1.1",
"project_urls": {
"Documentation": "https://FloriaConsoleGUI.github.io",
"Source": "https://github.com/FloriaProduction/FloriaConsoleGUI"
},
"split_keywords": [
"python",
"console",
"gui",
"ui",
"ux"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "c336798b3dc5fc78f53e86f8651ad4997ba29b77b168012b82118e54f8c296d2",
"md5": "d0338920a79ac0a337f79dd0840d642c",
"sha256": "7e850e1c794dcda507844fdebf57c649e30852321fc33955ef6003c31e23a7ba"
},
"downloads": -1,
"filename": "FloriaConsoleGUI-1.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d0338920a79ac0a337f79dd0840d642c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 49187,
"upload_time": "2025-01-18T08:17:51",
"upload_time_iso_8601": "2025-01-18T08:17:51.862522Z",
"url": "https://files.pythonhosted.org/packages/c3/36/798b3dc5fc78f53e86f8651ad4997ba29b77b168012b82118e54f8c296d2/FloriaConsoleGUI-1.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b6f13d91a52497fbc0d3e67abe859ac2b60ecdecfcc86d7f86543f89ea0f01c3",
"md5": "c7001c9006d6a84569d77dd4b7ad7042",
"sha256": "15c5687bd971a367dcff49a9298f90cf26f17fe5e4452add39f646ab55a3be1f"
},
"downloads": -1,
"filename": "FloriaConsoleGUI-1.1.1.tar.gz",
"has_sig": false,
"md5_digest": "c7001c9006d6a84569d77dd4b7ad7042",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 32665,
"upload_time": "2025-01-18T08:17:54",
"upload_time_iso_8601": "2025-01-18T08:17:54.502455Z",
"url": "https://files.pythonhosted.org/packages/b6/f1/3d91a52497fbc0d3e67abe859ac2b60ecdecfcc86d7f86543f89ea0f01c3/FloriaConsoleGUI-1.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-18 08:17:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "FloriaProduction",
"github_project": "FloriaConsoleGUI",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "floriaconsolegui"
}