Add support for responding to node/edge click events
Greetings!
I'm not sure if this is within the scope of what you have in mind (or what is possible) with pyvis, but is there any chance support could be added to respond to node/edge click handlers (and perhaps, later, other events like "unfocus")?
This way, one could imagine doing something like embedding a pyvis network view inside a PyQt application, with a network view on one side, for which, selecting a node will trigger an event / change the view in the other part of the application.
Just a thought..
Feel free to close / triage this though if this is too far outside the scope of what you have in mind.
Either way, thanks for taking the time to create this and share it with the community! It is much appreciated.
Hi! This is absolutely something I always wanted to support. I am in the process of actually making this possible which involved restructuring the way some of dependencies were handled so these custom interactions could live in one JS file bundled with pyvis. I have a little something going on with #91 but as it stands, the current idea is to just have these custom interactions be coded in the JS file that gets served with the template. If the community is intrigued enough by this I hope contributions can be made by some JS ninjas to support a whole range of interactions :)
Thanks Giancarlo and Keith for the nice discussion. This is something I would also be very interested!
In the previous PR you will find the code in "experimental" able to merge.
I saw that this code uses the network.on method to register an handler and the corresponding callback. I was making some tests with pyqt and it is actually possible to run code with webEngineView.page().runJavaScript('console.log("test")').
The JS code can then return values though a callback (Plain data and all of the JSON data types as well as, for example, Date and ArrayBuffer)
There seems to be the concrete possibility to have a bidirectional communication between pyqt and pyvis :)
Let me know if you are interested in discussing this further
Hi. Can you explain your answer or give a link to them? "In the previous PR you will find the code in "experimental" able to merge.
I saw that this code uses the network.on method to register an handler and the corresponding callback. I was making some tests with pyqt and it is actually possible to run code with webEngineView.page().runJavaScript('console.log("test")').
The JS code can then return values though a callback (Plain data and all of the JSON data types as well as, for example, Date and ArrayBuffer)"
Is it possible to see this example?