eui-1.1.2
توضیحات
a fast and simple micro-framework for small browser-based application
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | eui-1.1.2 |
| نام | eui |
| نسخه کتابخانه | 1.1.2 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Li Xiangkui |
| ایمیل نویسنده | 1749498702@qq.com |
| آدرس صفحه اصلی | https://gitee.com/lixkhao/eui |
| آدرس اینترنتی | https://pypi.org/project/eui/ |
| مجوز | MIT Licence |
# eui
eui means easy UI. It is a fast and simple micro-framework for small browser-based applications.
Python and JS communicate through websocket protocol.
## install
```cmd
pip install eui
```
## example
### Step 1:
create python file, `main.py`:
```python
import webbrowser
import eui
def say_hello(message):
print('receive message from js:', message)
eui.js('''
(msg) => {
alert('receive message from py: ' + msg)
}
''', message)
def startup_callback():
webbrowser.open(f'http://localhost:{eui.get_port()}/static/index.html')
handlers = {
'say_hello': say_hello,
'exit': eui.exit
}
eui.start(handlers=handlers, callback=startup_callback)
```
### Step 2:
create UI file `index.html` in `static` folder:
```html
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>eui test</title>
<script src="eui.js"></script>
<script type="text/javascript">
function sendMessage() {
var message = document.getElementById('message').value;
eui.py('say_hello', message);
}
</script>
</head>
<body>
<input id="message">
<button onclick="sendMessage()">Send</button>
</body>
</html>
```
### Step 3:
run `main.py`
snapshot:

نحوه نصب
نصب پکیج whl eui-1.1.2:
pip install eui-1.1.2.whl
نصب پکیج tar.gz eui-1.1.2:
pip install eui-1.1.2.tar.gz