On Sun, Jul 27, 2008 at 9:54 PM, John Hunter <[EMAIL PROTECTED]> wrote:
> On Sun, Jul 27, 2008 at 4:57 PM, Paul Kienzle <[EMAIL PROTECTED]> wrote:
>
>> My inclination is to avoid diamond inheritance in this case by
>> moving the wx base class to wxagg. Let me know and I will
>> implement it.
>
> My weak preference would be to do this as a mixin factorint out the
> renderer from the GUI stuff. If this is only marginally harder, it
> makes it easier down the road if someone wants to mixin a different
> renderer from agg, or if the wx renderer ever improces sufficiently to
> make it usable. But if this seems like a lot more work, I am not
> averse to simply deprecating the wx renderer, though factoring
> everything to make mixing in a different renderer later will still be
> useful. In the end, whatever you decide will be fine.
I won't be able to spend time on this short term --- it took me too
long to sort out containment and drawing.
>> There is one more outstanding change to wx before I can stop
>> subclassing the WxAgg canvas in my own applications, which is
>> that draw is being called too often. Putting a print statement in
>> WxAgg draw and _onPaint I get the following:
>
> OK, now that we have missed the debian freeze, the pressure to get
> something out sooner is lessened, do we'll just work on getting it
> right.
I hope that wasn't on account of wx. These were not show-stopper
issues.
Since we are not under pressure, I committed another set of changes
to Wx+WxAgg. Now they should only render the graph when the
window is shown. I would appreciate having windows and linux users
beat on it for a while, in particular testing lasso_demo before and after
printing.
I'm also attaching embedding_in_wx5.py, which puts a pair of graphs
into a wx notebook.
- Paul
import wx
import wx.aui
import matplotlib as mpl
from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas
from matplotlib.backends.backend_wxagg import NavigationToolbar2Wx as Toolbar
class Plot(wx.Panel):
def __init__(self, parent, id = -1, dpi = None, **kwargs):
wx.Panel.__init__(self, parent, id=id, **kwargs)
self.figure = mpl.figure.Figure(dpi=dpi, figsize=(2,2))
self.canvas = Canvas(self, -1, self.figure)
self.toolbar = Toolbar(self.canvas)
self.toolbar.Realize()
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(self.canvas,1,wx.EXPAND)
sizer.Add(self.toolbar, 0 , wx.LEFT | wx.EXPAND)
self.SetSizer(sizer)
class PlotNotebook(wx.Panel):
def __init__(self, parent, id = -1):
wx.Panel.__init__(self, parent, id=id)
self.nb = wx.aui.AuiNotebook(self)
sizer = wx.BoxSizer()
sizer.Add(self.nb, 1, wx.EXPAND)
self.SetSizer(sizer)
def add(self,name="plot"):
page = Plot(self.nb)
self.nb.AddPage(page,name)
return page.figure
def demo():
app = wx.PySimpleApp()
frame = wx.Frame(None,-1,'Plotter')
plotter = PlotNotebook(frame)
axes1 = plotter.add('figure 1').gca()
axes1.plot([1,2,3],[2,1,4])
axes2 = plotter.add('figure 2').gca()
axes2.plot([1,2,3,4,5],[2,1,4,2,3])
#axes1.figure.canvas.draw()
#axes2.figure.canvas.draw()
frame.Show()
app.MainLoop()
if __name__ == "__main__": demo()
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel