wxPython 2.8.12 / 2.9.x and Matplotlib backend_wx

Hi,

I noticed that something broke the backend_wx as of the 2.9 series.

When using e.g. the mpl.examples.embedded_in_wx2.py it works correctly in 2.8.12 but in 2.9.5 an empty canvas is shown and no error.

The problem shows on Windows but things work on a Mac (as reported by another user of MPL).

Has something changed in 2.9+ which affects the way one uses e.g. GraphicsContext, PaintDC and friends - my current suspects.

Werner

Werner, Google shows no results for embedded_in_wx2.py

Can you post a link or the file itself? I feel like I used matplotlib successfully before, and I’ve only ever used 2.9.4-MSW and up from there.

Hi Nathan,

embedding_in_wx2.py (3.29 KB)

···

On 8/29/2014 19:10, Nathan McCorkle wrote:

Werner, Google shows no results for embedded_in_wx2.py

Can you post a link or the file itself? I feel like I used matplotlib successfully before, and I've only ever used 2.9.4-MSW and up from there.

It is in the mpl examples.user_interfaces folder, attached as I am not sure where you get the folder from if you don't have the repo cloned.

Werner

And you need to uncomment "#matplotlib.use('WX')" and comment the corresponding 'WXAgg' lines

Werner

···

On 8/29/2014 19:24, Werner wrote:

Hi Nathan,

On 8/29/2014 19:10, Nathan McCorkle wrote:

Werner, Google shows no results for embedded_in_wx2.py

Can you post a link or the file itself? I feel like I used matplotlib successfully before, and I've only ever used 2.9.4-MSW and up from there.

It is in the mpl examples.user_interfaces folder, attached as I am not sure where you get the folder from if you don't have the repo cloned.

Werner

BTW, I see this problem both with MPL 1.3.1 and 1.4.0.

Maybe to do with the reorganization of DC in 2.9.0 - http://wxpython.org/Phoenix/docs/html/DC.html

Werner

···

On 8/29/2014 18:04, Werner wrote:

Hi,

I noticed that something broke the backend_wx as of the 2.9 series.

When using e.g. the mpl.examples.embedded_in_wx2.py it works correctly in 2.8.12 but in 2.9.5 an empty canvas is shown and no error.

The problem shows on Windows but things work on a Mac (as reported by another user of MPL).

Has something changed in 2.9+ which affects the way one uses e.g. GraphicsContext, PaintDC and friends - my current suspects.

Hi,

I noticed that something broke the backend_wx as of the 2.9 series.

When using e.g. the mpl.examples.embedded_in_wx2.py it works correctly
in 2.8.12 but in 2.9.5 an empty canvas is shown and no error.

The problem shows on Windows but things work on a Mac (as reported by

another user of MPL).

Has something changed in 2.9+ which affects the way one uses e.g.
GraphicsContext, PaintDC and friends - my current suspects.

BTW, I see this problem both with MPL 1.3.1 and 1.4.0.

Hi Werner,

If it is somehow helpful to know, I just checked and I don't see this
problem with the following setup:

- Windows XP (I know, I know)
- '2.9.4.0 msw (classic)'
- Python 2.7
- Matplotlib 1.3.1

I ran the example and it shows the plot fine.

It seems like the differences here could be Windows XP, or, more likely,
2.9.4 vs. 2.9.x...?

Che

···

On Mon, Sep 1, 2014 at 5:29 AM, Werner <wernerfbd@gmx.ch> wrote:

On 8/29/2014 18:04, Werner wrote:

Maybe to do with the reorganization of DC in 2.9.0 -
http://wxpython.org/Phoenix/docs/html/DC.html

Werner

--
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 wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Did you comment the ‘wxagg’ lines and un-comment the ‘wx’ lines at
the beginning of the sample?
The ‘wxagg’ backend works for me but the ‘wx’ only shows an empty
screen/canvas instead of showing the line graph.
Anyhow, thanks for testing.
Werner

···

Hi Che,

  On 9/1/2014 17:36, C M wrote:
        On Mon, Sep 1, 2014 at 5:29 AM,

Werner wernerfbd@gmx.ch
wrote:

On 8/29/2014 18:04, Werner wrote:

Hi,

              I noticed that something broke the backend_wx as of

the 2.9 series.

              When using e.g. the [mpl.examples.embedded_in_wx2.py](http://mpl.examples.embedded_in_wx2.py)
              it works correctly in 2.8.12 but in 2.9.5 an empty

canvas is shown and no error.

              The problem shows on Windows but things work on a Mac

(as reported by another user of MPL).

              Has something changed in 2.9+ which affects the way

one uses e.g. GraphicsContext, PaintDC and friends -
my current suspects.

BTW, I see this problem both with MPL 1.3.1 and 1.4.0.

Hi Werner,

          If it is somehow helpful to know, I just checked and I

don’t see this problem with the following setup:

  • Windows XP (I know, I know)
  • ‘2.9.4.0 msw (classic)’
  • Python 2.7
  • Matplotlib 1.3.1

I ran the example and it shows the plot fine.

I ran the example and it shows the plot fine.

Did you comment the 'wxagg' lines and un-comment the 'wx' lines at the
beginning of the sample?

The 'wxagg' backend works for me but the 'wx' only shows an empty
screen/canvas instead of showing the line graph.

Hi Werner. No, sorry, I overlooked that instruction in the email thread
above, and tried it now, and yes, I am seeing the same thing as you now.
The canvas area just shows whatever other windows on the screen were under
that window when it was first painted.

Do you specifically want to use the wx backend as opposed to the wxagg one,
or are you just bringing the breakage with this backend/upgrade to the
community's attention? I ask because I never know if one is preferred to
the other, though I assumed agg always is?

Che

I personally only use the ‘wxagg’ backend, but as I worked on a PR
() for MPL 1.4 to
get it to be compatible with Phoenix I run into the problem when I
was testing stuff. Initially I thought I messed something up but
then I noticed that the problem existed already with MPL 1.3, but
wanted to see if I could find a fix for it. One MPL user reported
on the PR that it works for him on OSX, so it looks like a Windows
only issue.
Werner

···

Hi Che,

  On 9/1/2014 23:19, C M wrote:
                        I ran the example and it shows the plot

fine.

            Did you comment the 'wxagg' lines and un-comment the

‘wx’ lines at the beginning of the sample?

            The 'wxagg' backend works for me but the 'wx' only shows

an empty screen/canvas instead of showing the line
graph.

          Hi Werner.  No, sorry, I overlooked that instruction in

the email thread above, and tried it now, and yes, I am
seeing the same thing as you now. The canvas area just
shows whatever other windows on the screen were under that
window when it was first painted.

          Do you specifically want to use the wx backend as

opposed to the wxagg one, or are you just bringing the
breakage with this backend/upgrade to the community’s
attention? I ask because I never know if one is preferred
to the other, though I assumed agg always is?

https://github.com/matplotlib/matplotlib/pull/3421

Hi all,
I also encountered problems of this kind some time ago;
two posts I can find in this context are:
http://wxpython-users.1045709.n5.nabble.com/possible-regression-in-wxpython-2-9-2-1-matplotlib-pylab-td4664884.html

http://matplotlib.1069221.n5.nabble.com/matplotlib-backends-WXAgg-vs-WX-td6189.html

For me, the problem appeared between
wxPython 2.9.1.1 and 2.9.2.1 (in that time with py 2.7.2, MPL 1.0.1,
using win 7);
(it's maybe interesting, that the earlier version of 2.9 appeared to work ok).

The problems were be solved/worked around by using WXAgg instead of
WX, as has been mentioned in this thread already.

regards,
    vbr

···

2014-08-29 18:04 GMT+02:00 Werner <wernerfbd@gmx.ch>:

Hi,

I noticed that something broke the backend_wx as of the 2.9 series.

When using e.g. the mpl.examples.embedded_in_wx2.py it works correctly in
2.8.12 but in 2.9.5 an empty canvas is shown and no error.

The problem shows on Windows but things work on a Mac (as reported by
another user of MPL).

Has something changed in 2.9+ which affects the way one uses e.g.
GraphicsContext, PaintDC and friends - my current suspects.

Werner

Hi,

Hi,

I noticed that something broke the backend_wx as of the 2.9 series.

When using e.g. the mpl.examples.embedded_in_wx2.py it works correctly in
2.8.12 but in 2.9.5 an empty canvas is shown and no error.

The problem shows on Windows but things work on a Mac (as reported by
another user of MPL).

Has something changed in 2.9+ which affects the way one uses e.g.
GraphicsContext, PaintDC and friends - my current suspects.

Werner

Hi all,
I also encountered problems of this kind some time ago;
two posts I can find in this context are:
http://wxpython-users.1045709.n5.nabble.com/possible-regression-in-wxpython-2-9-2-1-matplotlib-pylab-td4664884.html

http://matplotlib.1069221.n5.nabble.com/matplotlib-backends-WXAgg-vs-WX-td6189.html

For me, the problem appeared between
wxPython 2.9.1.1 and 2.9.2.1 (in that time with py 2.7.2, MPL 1.0.1,
using win 7);
(it's maybe interesting, that the earlier version of 2.9 appeared to work ok).

Thanks for the links.

The problems were be solved/worked around by using WXAgg instead of
WX, as has been mentioned in this thread already.

If I read the code correctly then the big difference in the wxAgg vs wx backend is that the later uses a wx.MemoryDC and wx.GraphicsContext, and then draws to the screen using a wx.PaintDC, where wxAgg converts the agg buffer to a Bitmap which is then drawn using the wx.PaintDC.

The strange thing is that the bitmap is correct, as I can save it to a file using the following in mpl.backend_wx.gui_repaint:
self.bitmap.SaveFile('mplimage.png', wx.BITMAP_TYPE_PNG)

just before the call to 'drawDC.DrawBitmap'

Werner

···

On 9/2/2014 11:49, Vlastimil Brom wrote:

2014-08-29 18:04 GMT+02:00 Werner <wernerfbd@gmx.ch>: