matplotlib runs perfectly on Windows, but is not compatible with Mac OS X, cannot be scaled operation, does not refresh gui,have encountered this problem?
matplotlib runs perfectly on Windows, but is not compatible with Mac OS X, cannot be scaled operation, does not refresh gui,have encountered this problem?
It is this effect, scaling, when the form is not refreshed。
在 2014年9月2日星期二UTC+8下午9时46分24秒,goo…@gmail.com写道:
···
matplotlib runs perfectly on Windows, but is not compatible with Mac OS X, cannot be scaled operation, does not refresh gui,have encountered this problem?
wrote:
It’s been a couple years since I used MPL much, but IIRC this is a problem in the MPL code in how they are using wx.ClientDC. They are doing something like drawing with a wx.ClientDC while moving or sizing objects instead of triggering a normal paint event. This is a bad idea on any platform, but because of the design of the native UI code on OSX it just can’t work reliably there. In most cases a wx.ClientDC should only be used for things like measuring text or such, and drawing to the screen should be done in a paint event, triggered by a Refresh if needed, and perhaps forced to be immediate with a call to Update().
I don’t remember details, and unfortunately I don’t have access to that code anymore, but I think I was able to work around this issue in my project by overriding some things in a class derived from MPL’s canvas.
Last I looked, the MPL wx code was a pretty ugly mess of clientDC, Blit(),
Refresh(), etc -- It started one way, then fixes were hacked on for
particular issues. It could really use some love, and a refactor to PaintDC
is probably what it needs.
If I need this to work for something, I may get in there and try to clean
it up -- but don't hold your breath, I've got too may other things on my
plate as it is. Sorry
But if someone wants to dig in, I'll try to help if you have specific
questions.
-Chris
···
On Tue, Sep 23, 2014 at 6:04 PM, Robin Dunn <robin@alldunn.com> wrote:
goofcc@gmail.com wrote:
It's been a couple years since I used MPL much, but IIRC this is a problem
in the MPL code in how they are using wx.ClientDC. They are doing
something like drawing with a wx.ClientDC while moving or sizing objects
instead of triggering a normal paint event.
--
Christopher Barker, Ph.D.
Oceanographer
Emergency Response Division
NOAA/NOS/OR&R (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
I started some time ago some work on mpl (1.4) wx backends, main
focus was to get it to work with Phoenix and to run on Python 3, see
this PR: Outstanding issues is that the ‘wx’ backend does not show graphic as
of 2.9 (this seems to be an old issue) on Windows but it works on
Mac (tested by jenshnielsen) in e.g. the embedding_in_wx2.py example
and the issue mentioned in this thread.
The current code uses wx.PaintDC in the OnPaint handler, it uses
wx.MemoryDC especially in the ‘wxagg’ backend together with
wx.GraphicsContext and then there is wx.ClientDC in gui_repaint
method if it is called without a wx.PaintDC.
I wouldn’t mind trying but would definitely need help and some tips
on how to get going.
Werner
It's been a couple years since I used MPL much, but IIRC
this is a problem in the MPL code in how they are using
wx.ClientDC. They are doing something like drawing with
a wx.ClientDC while moving or sizing objects instead of
triggering a normal paint event.
Last I looked, the MPL wx code was a pretty ugly mess
of clientDC, Blit(), Refresh(), etc – It started one way,
then fixes were hacked on for particular issues. It could
really use some love, and a refactor to PaintDC is
probably what it needs.
If I need this to work for something, I may get in
there and try to clean it up – but don’t hold your
breath, I’ve got too may other things on my plate as it
is. Sorry
But if someone wants to dig in, I'll try to help if you
Could you please try and change the backend_wx.py.
In the method ‘FigureCanvasWx.gui_repaint’ replace this:
drawDC.DrawBitmap(self.bitmap, 0, 0)
with this:
drawDC.Clear()
drawDC.DrawBitmap(self.bitmap, 0, 0)
Werner