Open simzer opened 1 year ago
Example: This is the example of event usage in the tutorial
click_handler_method = "alert(JSON.stringify(event.data));" click_handler = click_chart.on("click", click_handler_method)
Which will generate something like this in JS:
click_handler_method = event => { alert(JSON.stringify(event.data)); } click_handler = chart.on("click", click_handler_method)
The same could be supported with Python syntax:
click_handler_method = "js.alert(json.dumps(event.data))" click_handler = click_chart.on("click", click_handler_method)
Which would generate something like this in JS:
<script src="https://cdn.jsdelivr.net/pyodide/v0.22.1/full/pyodide.js"></script>
let pyodide = await loadPyodide(); let click_handler_method = (event) => { let handler = pyodide.runPython(` def handler(x): js.alert(json.dumps(event.data)) handler `); handler(event); }; click_handler = click_chart.on("click", click_handler_method)
or micropython https://micropython.org/
Example: This is the example of event usage in the tutorial
Which will generate something like this in JS:
The same could be supported with Python syntax:
Which would generate something like this in JS: