Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert javascript events to Node or Edge #268

Open
marimeireles opened this issue Jul 2, 2021 · 0 comments
Open

Convert javascript events to Node or Edge #268

marimeireles opened this issue Jul 2, 2021 · 0 comments
Labels
enhancement New feature or request python

Comments

@marimeireles
Copy link
Collaborator

I was creating some examples to scypy and noticed the events received in this case:

def paint_blue(event):
    auxNode = cyGraph.graph.nodes[int(event['data']['id'])]
    auxNode.classes += ' blue'
    
cyGraph.on('node', 'click', paint_blue)

Are a perfect Node instance. I think it'd make sense to convert this event to ipycytoscape.Node() on our backend. That'd remove the need to have this line auxNode = cyGraph.graph.nodes[int(event['data']['id'])].
This also works for Edge.

@marimeireles marimeireles added enhancement New feature or request python labels Jul 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request python
Projects
None yet
Development

No branches or pull requests

1 participant