File: state_change.py

package info (click to toggle)
python-trame-client 3.11.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 3,128 kB
  • sloc: python: 9,609; javascript: 3,897; sh: 9; makefile: 6
file content (19 lines) | stat: -rw-r--r-- 414 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
from trame.app import get_server
from trame.widgets import client, html
from trame.ui.html import DivLayout

server = get_server(client_type="vue2")


def a_changed():
    print(f"a={server.state.a}")


with DivLayout(server) as layout:
    html.Div("{{ a }}")
    html.Input(type="range", v_model=("a", 1))
    client.ClientStateChange(value="a", change=a_changed)


if __name__ == "__main__":
    server.start()