Open nukadelic opened 6 years ago
You need to find some widgets has internal envent loop . Then be able to be added callback function to update/refresh data. Aboves you tried seem do "push" data work . It only can work when buld yourself widgets.
see below some widgets. bokeh and https://ipywidgets.readthedocs.io/en/stable/examples/Widget%20Asynchronous.html
My goal is to run JS canvas-game within a notebook and get continues data stream between itself and Python. First i have tried to execute notebook kernel from JS, 60 times per second, with an animation frame request hook. But then it hit me, this process is working on a single kernel. Here is my initial attempt:
So that resulted in non changing sharedVariable value during the cell execution
After which i have decided to try and use the COMM, so I made a simple one that will replay with a string value after 500ms of delay.
And a matching Python COMM:
But that didn't help either, as apparently the messaged were getting received only after the cell had completed it's execution
Also i have tried creating a separate async function
But the problem didn't go away
I had a brief overview of
ipywidgets
and was able to get one way communication to work like so:But the widgets won't work if you change the slider by dragging it