embedding in wx -- problems

Hi,
I have wx app with MPL plots embedded. There are two problems I noticed
after upgrading wxPython to 2.6.1 and MPL to current CVS:
When toolbar (i.e. NavigationToolbar2WX) has parent different then wx.Frame,
(wx.Panel in my case), it crashes when clicking "Save" button.
The problem is that wx.FileDialog has to have top level window as its parent.
The workaround is eg. to set toolbar._parent=None (a dialog created with
None parent window is given the application's top level window as parent)

I haven't solved the second problem yet. It can be seen on simple_plot.py.
When I decrease window's size plot doesn't shrink like in GTK backend,
and only part of the plot is visible. It used to work properly in older
wx and MPL versions.

Marcin

···

--
Marcin Wojdyr | http://www.unipress.waw.pl/~wojdyr

Marcin,

I have wx app with MPL plots embedded. There are two problems
I noticed after upgrading wxPython to 2.6.1 and MPL to current
CVS: When toolbar (i.e. NavigationToolbar2WX) has parent
different then wx.Frame, (wx.Panel in my case), it crashes
when clicking "Save" button. The problem is that wx.FileDialog
has to have top level window as its parent. The workaround is
eg. to set toolbar._parent=None (a dialog created with None
parent window is given the application's top level window as
parent)

I think it's a known feature of the Toolbars that they use a
Frame not a Panel, at least for the wx backend. It's hard for
me to get excited about this as I don't use the Toolbars, but if
you can send a patch that makes them work for a Panel, that's
fine with me.

I haven't solved the second problem yet. It can be seen on
simple_plot.py.. When I decrease window's size plot doesn't
shrink like in GTK backend, and only part of the plot is
visible. It used to work properly in older wx and MPL
versions.

You didn't specify an OS, which probably means linux ;). I
don't see this problem on Windows or Mac, but haven't installed
wxPython 2.6.1 on linux yet.

--Matt

Matt Newville wrote:

Marcin,

I think it's a known feature of the Toolbars that they use a
Frame not a Panel, at least for the wx backend. It's hard for

Usually they use Frame, but they can also work with another Windows.

me to get excited about this as I don't use the Toolbars, but if
you can send a patch that makes them work for a Panel, that's
fine with me.

Toolbars work fine, the only problem was with the parent of FileDialogs.
Very simple patch is attached.

I haven't solved the second problem yet. It can be seen on
simple_plot.py.. When I decrease window's size plot doesn't
shrink like in GTK backend, and only part of the plot is
visible. It used to work properly in older wx and MPL
versions.

You didn't specify an OS, which probably means linux ;). I

yes :slight_smile:

Marcin

parent.diff (1006 Bytes)

···

--
Marcin Wojdyr | http://www.unipress.waw.pl/~wojdyr