Re: FigureCanvasWxAgg not redrawn with wxpython 4.0.1 on Ubuntu 17.10

"'Chris Barker' via wxPython-dev" <[email protected]> Wed, 5 Sep 2018 14:19:13 +0200
Newsgroups gmane.comp.python.wxpython.devel
Message-ID <CALGmxEL3UfGqrYiJWC0KdJfhzJaNNHmQfAQ_Zk8a1fHjqjZk3A@mail.gmail.com>
FWIW,

I used a similar approach for years for wx.lib.floatcanvas -- I honestly
have not tested it recently with Phoenix.

But I think the goal here was to no longer use ClientDC, and rather, use
ex.Overlay instead.

How is that working? quite some years back, I tried to get rid of ClientDC,
and found that the alternative (.Refresh(), .Update() and PaintDC) was to
responsive enough to follow mouse movements.

Maybe it's better now?

-CHB


On Wed, Sep 5, 2018 at 3:34 AM, Matthew Newville <[email protected]>
wrote:

>
> Hi Dietmar,
>
> On Sunday, August 26, 2018 at 4:49:55 PM UTC-5, Dietmar Schwertberger
> wrote:
>>
>> There is now a matplotlib pull-request that implements the wx backends
>> without Client DC:
>>
>> https://github.com/matplotlib/matplotlib/pull/11944
>>
>> For me, this seems to work on Windows, Ubuntu 17 w. Wayland and X and
>> also on Mac OS.
>>
>>
> Thanks, and apologies for coming in late to the discussion or not
> understanding all the issues here.
>
> I read the discussion at the matplotlib PR and Issues #10417 and #11425,
> and I am left somewhat puzzled.
>
> That is, I use Wayland (with Fedora28) and MacOS (on a Macbook Pro, but
> not a Retina display) with Python 3.6, wxPython 4, mostly with
> matplotlib 2.2, but starting to use 3.   For rubber-banding and drawing
> with DC and matplotlib, I almost always use wxmplot (https://github.com/
> newville/wxmplot) which uses `backend_wxagg` and this code (
> https://github.com/newville/wxmplot/blob/94303f7c779a154683e0f839e83cee
> 82504a62f4/lib/basepanel.py#L488)  in motion events to draw the
> rubber-band box:
>
>
> is_wxPhoenix = 'phoenix' in wx.PlatformInfo
>
> zdc = wx.ClientDC(self.canvas)
> zdc.SetLogicalFunction(wx.XOR)
> zdc.SetBrush(wx.TRANSPARENT_BRUSH)
> zdc.SetPen(wx.Pen('White', 2, wx.SOLID))
> zdc.ResetBoundingBox()
> if not is_wxPhoenix:
>     zdc.BeginDrawing()
>
> # erase previous box
> # (note that self.rbbox is initialized to None)
> if self.rbbox is not None:
>     zdc.DrawRectangle(*self.rbbox)
>
> # x0, y0, width, height found from image size and events
> self.rbbox = (x0, y0, width, height)
> zdc.DrawRectangle(*self.rbbox)
> if not is_wxPhoenix:
>     zdc.EndDrawing()
>
>
> This seems to have always worked well for me.   FWIW, the XOR bitmask
> works great on light and dark images, and on images, except in the rare
> cases where there are large fields of mid-level greys (don't use #888888 as
> a background colour!).   Except for the Phoenix-specific test for
> "Begin/EndDrawing", this code is essentially unchanged going back at least
> 7 years, spanning many versions of wxPython, and Python, and on Linux with
> X11 and Wayland, Windows, and MacOS.
>
> That is, I don't see the reported errors with ClientDC.
>
> Is there a problem I am not seeing that others are seeing?
> Is there a better way to draw a rubber-band box on top of a
> matplotlib canvas?
>
> Thanks!
>
> --Matt
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "wxPython-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>



-- 

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

[email protected]

-- 
You received this message because you are subscribed to the Google Groups "wxPython-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
For more options, visit https://groups.google.com/d/optout.