reusing the pylab gui in a custom application (wxpython)?

Hi all,
I'd like to ask about the possibility to eventually reuse the gui of
pylab for showing and manipulating the plots in the custom application
(written in wxpython).
Basically, I'd like to add some application specific controls to the
toolbar, or to place the existing gui to a custom frame, which would
add such additional controls (slider, buttons, etc.)
I looked at ...
Python27\Lib\site-packages\matplotlib\backends\backend_wx.py , but
couldn't find any way to access this windows in custom code.
Would it be possible at all, or are there other options? Is there
maybe some equivalent class/module etc. which could be reused or
adapted?
Or is the only way to reimplement the functionality writing my own
plot gui (or to have the additionally needed controls in a separate
window, which doesn't look very elegant, but could probably work).

Thanks in advance for any hints
  regards
Vlastimil Brom

Absolutely! It is one of the things mpl does best. Do a search in the online documentation for “embedding codex”.

I hope that helps!

Ben Root

···

On Sunday, July 29, 2012, Vlastimil Brom wrote:

Hi all,

I’d like to ask about the possibility to eventually reuse the gui of

pylab for showing and manipulating the plots in the custom application

(written in wxpython).

Basically, I’d like to add some application specific controls to the

toolbar, or to place the existing gui to a custom frame, which would

add such additional controls (slider, buttons, etc.)

I looked at …

Python27\Lib\site-packages\matplotlib\backends\backend_wx.py , but

couldn’t find any way to access this windows in custom code.

Would it be possible at all, or are there other options? Is there

maybe some equivalent class/module etc. which could be reused or

adapted?

Or is the only way to reimplement the functionality writing my own

plot gui (or to have the additionally needed controls in a separate

window, which doesn’t look very elegant, but could probably work).

Thanks in advance for any hints

regards

Vlastimil Brom

2012/7/30 Benjamin Root <ben.root@...1304...>:

Hi all,
I'd like to ask about the possibility to eventually reuse the gui of
pylab for showing and manipulating the plots in the custom application
(written in wxpython).
[...]
Thanks in advance for any hints
  regards
Vlastimil Brom

Absolutely! It is one of the things mpl does best. Do a search in the online
documentation for "embedding codex".

I hope that helps!

Ben Root

Thanks for the quick response and a useful hint!

I apparently didn't search for the right terms before...
I turns out, that
http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx2.html
shows exactly, what I need.

By the way is there a place to propose a small correction of the example code?
namely
        self.SetBackgroundColour(wx.NamedColor("WHITE"))

causes an error in wxpython 2.9, which removed the "...Color" aliases
and only knows "...Colour"
hence:

        self.SetBackgroundColour(wx.NamedColour("WHITE"))

works in wxpython 2.9 and should be backwards compatible too.

Thanks again,
    vbr

···

On Sunday, July 29, 2012, Vlastimil Brom wrote:

Thanks for catching that mistake. Unfortunately, we don’t do a good enough job of keeping up to date on changes in various backends. The best way to make sure that gets fixed is to send us a pull request on github. At the very least, post an issue report on it.

Ben

···

On Sun, Jul 29, 2012 at 7:39 PM, Vlastimil Brom <vlastimil.brom@…287…> wrote:

2012/7/30 Benjamin Root <ben.root@…1304…>:

On Sunday, July 29, 2012, Vlastimil Brom wrote:

Hi all,

I’d like to ask about the possibility to eventually reuse the gui of

pylab for showing and manipulating the plots in the custom application

(written in wxpython).

[…]
Thanks in advance for any hints

regards

Vlastimil Brom

Absolutely! It is one of the things mpl does best. Do a search in the online

documentation for “embedding codex”.

I hope that helps!

Ben Root

Thanks for the quick response and a useful hint!

I apparently didn’t search for the right terms before…

I turns out, that

http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx2.html

shows exactly, what I need.

By the way is there a place to propose a small correction of the example code?

namely

    self.SetBackgroundColour(wx.NamedColor("WHITE"))

causes an error in wxpython 2.9, which removed the “…Color” aliases

and only knows “…Colour”

hence:

    self.SetBackgroundColour(wx.NamedColour("WHITE"))

works in wxpython 2.9 and should be backwards compatible too.

Thanks again,

vbr

2012/7/31 Benjamin Root <ben.root@...1304...>:

2012/7/30 Benjamin Root <ben.root@...1304...>:
>
>
>>
>> Hi all,
>> I'd like to ask about the possibility to eventually reuse the gui of
>> pylab for showing and manipulating the plots in the custom application
>> (written in wxpython).
>> [...]
>> Thanks in advance for any hints
>> regards
>> Vlastimil Brom
>
>
> Absolutely! It is one of the things mpl does best. Do a search in the
> online
> documentation for "embedding codex".
>
> I hope that helps!
>
> Ben Root

Thanks for the quick response and a useful hint!

I apparently didn't search for the right terms before...
I turns out, that

http://matplotlib.sourceforge.net/examples/user_interfaces/embedding_in_wx2.html
shows exactly, what I need.

By the way is there a place to propose a small correction of the example
code?
namely
        self.SetBackgroundColour(wx.NamedColor("WHITE"))

causes an error in wxpython 2.9, which removed the "...Color" aliases
and only knows "...Colour"
hence:

        self.SetBackgroundColour(wx.NamedColour("WHITE"))

works in wxpython 2.9 and should be backwards compatible too.

Thanks again,
    vbr

Thanks for catching that mistake. Unfortunately, we don't do a good enough
job of keeping up to date on changes in various backends. The best way to
make sure that gets fixed is to send us a pull request on github. At the
very least, post an issue report on it.

Ben

Thanks, I created an issue:

about this and also tried to send the pull requests about the four
"wx.NamedColor" occurrences I could find.
Unfortunately, I haven't any experiences with code management tools
and github infrastructure, I didn't mess something up.

Regards,
  vbr

···

On Sun, Jul 29, 2012 at 7:39 PM, Vlastimil Brom <vlastimil.brom@...287...> > wrote:

> On Sunday, July 29, 2012, Vlastimil Brom wrote: