On Sun, 16 Sep 2012 22:23:18 -0700 (PDT)
felix74 <[email protected]> wrote:
> I'm trying to create a interactive chart in a embedded in a new leo pane
> using matplotlib. However, I am not sure about the the best way to
> implement this. I would appreciate some guidance on this please? The
> questions I would like answered are:
> 1/ How do I create a new blank pane for embedding a chart as well as other
> QtWidgets.
> 2/ Can I do this in a script or do I need to work with leo source
You can run this script from any body pane:
---cut here---
from PyQt4 import QtGui
class MatplotPaneProvider:
def __init__(self, c):
self.c = c
if hasattr(c, 'free_layout'):
splitter = c.free_layout.get_top_splitter()
if splitter:
splitter.register_provider(self)
def ns_provides(self):
return[('Add matplot', '_add_matplot_pane')]
def ns_provide(self, id_):
if id_ == '_add_matplot_pane':
c = self.c
w = QtGui.QSlider()
return w
def ns_provider_id(self):
# used by register_provider() to unregister previously registered
# providers of the same service
# provider ID is not the same as the service id_ above
return "completely unique value here"
MatplotPaneProvider(c)
---cut here---
Paste just as above and run the script. Nothing happens. Right click
on one of the pane dividers and select Insert. A new pane with a
button 'Action' appears. Click it, and select "Add matplot" from the
context menu.
Instead of "w = QtGui.QSlider()", you want "w = myMatplotWidget()"
Cheers -Terry
> The context for wanting to do this is that I want to create a data
> processing and visualization tool kit in leo. Like Excel but using nodes
> instead of columns. As such I have data in nodes and can create new data
> nodes by applying python functions to data in existing nodes. The thing
> missing is the visualization within a leo pane (I can easily launch a chart
> in it's own window) .
>
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/leo-editor?hl=en.