graph visualization implementation

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

graph visualization implementation

Katherine P
Good day, everyone!

Apologies if my question might sound incompetent but I am new to GUI and have been googling and trying things out for weeks now before I came here :)

Current setup: I already have python code which builds graph from grammar, can be accessed as networkx

What I need to do: I want to visualize it and make clickable nodes. Upon a click another python script should be triggered and substitution graph presented to the right

So far I only managed to save graph as image in /tmp/ and load it. Which is not useful since the nodes should be clickable.. And another addition - graphs can be different, that is why i rejected the idea of binding image to click event..

So the questions would be:
1. Is this even possible with wxPython? I did not manage to find any relevant examples
2. What is the best way to display the graph with clickable nodes in my case?
3. Any advices/suggestions/comments are welcome, I am sadly stuck

Thanks!

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: graph visualization implementation

Igor Korot
Hi,

On Thu, Jul 6, 2017 at 8:34 PM, Katherine P <[hidden email]> wrote:

> Good day, everyone!
>
> Apologies if my question might sound incompetent but I am new to GUI and
> have been googling and trying things out for weeks now before I came here :)
>
> Current setup: I already have python code which builds graph from grammar,
> can be accessed as networkx
>
> What I need to do: I want to visualize it and make clickable nodes. Upon a
> click another python script should be triggered and substitution graph
> presented to the right
>
> So far I only managed to save graph as image in /tmp/ and load it. Which is
> not useful since the nodes should be clickable.. And another addition -
> graphs can be different, that is why i rejected the idea of binding image to
> click event..
>
> So the questions would be:
> 1. Is this even possible with wxPython? I did not manage to find any
> relevant examples
> 2. What is the best way to display the graph with clickable nodes in my
> case?
> 3. Any advices/suggestions/comments are welcome, I am sadly stuck

It is possible in C++:
https://wiki.wxwidgets.org/WxFAQ#How_can_I_create_diagrams_with_connected_nodes.3F.
And maybe some of those are ported to {wx}python.

Thank you.

>
> Thanks!
>
> --
> You received this message because you are subscribed to the Google Groups
> "wxPython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [hidden email].
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: graph visualization implementation

Chris Barker - NOAA Federal
In reply to this post by Katherine P
On Thu, Jul 6, 2017 at 5:34 PM, Katherine P <[hidden email]> wrote:
Current setup: I already have python code which builds graph from grammar, can be accessed as networkx

What I need to do: I want to visualize it and make clickable nodes. Upon a click another python script should be triggered and substitution graph presented to the right

So far I only managed to save graph as image in /tmp/ and load it. Which is not useful since the nodes should be clickable.. And another addition - graphs can be different, that is why i rejected the idea of binding image to click event..

yeah, that would be hard to make flexible.


So the questions would be:
1. Is this even possible with wxPython? I did not manage to find any relevant examples

of course it is -- you can draw anything you want, and do whatever yu want with mouse clicks. However, you probably don't want to do all this with low-level code yourself.
 
2. What is the best way to display the graph with clickable nodes in my case?

there are two libraries that could be very helpful:

wxOGL

wx.lib.floatcanvas

I think OGL is designed specifically for diagrams with boxes-connected-by-lines, so may be perfect.

floatcanvas is more general, but has a l ot of nifty features that make it pretty easy to do this sort of thing.

for floatcanvas, you can see a lot of examples here:


in particular, look at:

node_tree.py

and 

ProcessDiagram.py

The "trick" is that you'll need to figure out the layout yourself -- i.e. where to put the boxes so they don't overlap, etc, etc.... maybe networkx can help with that?

-CHB


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[hidden email]

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: graph visualization implementation

Chris Barker - NOAA Federal
On Fri, Jul 7, 2017 at 12:17 PM, Chris Barker <[hidden email]> wrote:
The "trick" is that you'll need to figure out the layout yourself -- i.e. where to put the boxes so they don't overlap, etc, etc.... maybe networkx can help with that?

I just took a quick look at networkx -- it provides some support for drawing graphs using matplotlib.

So you could embedd an MPL graph in your wx app, though it may be hard to get teh clicking behaviour you want.

Unfortunately, it looks like they used the non-OO interface to MPL, so if you want to draw to an embedded graph, and/or want to access the layout info without actually using MPL, you'll need to go into the source and extract what you need :-( I haven't looked to see how well structured it is in side -- could be easy or hard, depending.

-CHB


 
-- 

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            <a href="tel:(206)%20526-6959" value="+12065266959" target="_blank">(206) 526-6959   voice
7600 Sand Point Way NE   <a href="tel:(206)%20526-6329" value="+12065266329" target="_blank">(206) 526-6329   fax
Seattle, WA  98115       <a href="tel:(206)%20526-6317" value="+12065266317" target="_blank">(206) 526-6317   main reception

[hidden email]



--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

[hidden email]

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: graph visualization implementation

Katherine P
In reply to this post by Katherine P
Thanks everyone!

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: graph visualization implementation

Dietmar Schwertberger-2
In reply to this post by Katherine P
On 7/7/17 2:34 AM, Katherine P wrote:
So the questions would be:
1. Is this even possible with wxPython? I did not manage to find any relevant examples
Did you have a look at the OGL demo? It's in the main wxPython demo in section Miscellaneous.


Regards,
Dietmar

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...