You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
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.
%%javascriptJupyter.notebook.kernel.comm_manager.register_target('my_comm_id',(comm,msg)=>{comm.on_msg(_=>{// on msg received setTimeout(_=>{// wait 500mscomm.send(window.getGameVar());// output data},500);});});
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.
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
The text was updated successfully, but these errors were encountered: