8000 WXAgg embedded navigation zoom, home, back not working · Issue #4109 · matplotlib/matplotlib · GitHub
[go: up one dir, main page]

Skip to content

WXAgg embedded navigation zoom, home, back not working #4109

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
digitalnumeric opened this issue Feb 16, 2015 · 22 comments
Closed

WXAgg embedded navigation zoom, home, back not working #4109

digitalnumeric opened this issue Feb 16, 2015 · 22 comments

Comments

@digitalnumeric
Copy link

I have a figure canvas and navigation bar embedded in a wx.Dialog. In matplotlib version 1.2.1 and earlier the zoom, home, back (and pan) all worked fine. If I upgrade to 1.3 (or 1.4.2) zoom, home, and back stop working. Only pan works. Any time I zoom, the zoom rectangle is drawn but nothing happens. The zoom rectangle remains on the screen after I release the mouse button. If I then switch to pan and left-click to pan the zoom takes effect. Same thing with the home and back buttons. If I click them nothing happens until I switch to pan and actually left click and pan then they take effect.

I also tried this with the user interface example: embedding_in_wx2.py
Running it alone it is fine. If I put it in my app and do the following:

    def OnShowClicked(self, event):
        frame = CanvasFrame()
        frame.Show(True)

The window shows correctly, but the zoom, home, back don't work just as I described above.

I looked through the changes between 1.2.1 and >=1.3 but I didn't see anything that would point to this. What changed between these versions that might causes this issue.

How do I work around this issue? Is there an example somewhere that shows the right way to do things now to get zoom, home, back, etc. working again?

Thanks.

@tacaswell
Copy link
Member

what os? Does the problem exist with 1.4.3?

@tacaswell
Copy link
Member

And am I understanding correctly that the demo works correctly (in that pan/zoom/the navigation buttons all work) but if you embed the demo on another application it does not work correctly?

@digitalnumeric
Copy link
Author

Windows 7 Pro 64-bit
The latest stable I see is 1.4.2
Yes the demo works correctly until it is embedded
I have 32-bit python 2.7.9 installed

@tacaswell
Copy link
Member

I just made the 1.4.3 windows binaries visible https://sourceforge.net/projects/matplotlib/files/matplotlib/matplotlib-1.4.3/ 1.4.3rc1 is almost identical and would work too.

@tacaswell tacaswell added this to the unassigned milestone Feb 16, 2015
@tacaswell
Copy link
Member

It is not clear no me why this is a bug in mpl and not a bug in how you are doing the embedding. Can you provide us with a minimal example that fails to work?

@digitalnumeric
Copy link
Author

I am using wx version 2.8.12.1 (msw-unicode)
The code works fine with the old version 1.2.1 of mpl with wx 2.8.12.1.
If I leave all else the same and just upgrade to mpl > 1.2.1 I see the issue.
I will try to get you a minimal failing example

@tacaswell
Copy link
Member

My guess is that this commit is related: f237a74

@tacaswell
Copy link
Member

Which is a cherry-pick of 0a160ad which was merged to master in c001797 as part of #2316

@digitalnumeric
Copy link
Author

Could this change #1849 have side effects like what I am seeing?

@efiring
Copy link
Member
efiring commented Feb 17, 2015

#2316 is a pretty standard way of dealing with the deprecation of Wx.PySimpleApp. I can't imagine how it could cause the symptoms listed. Instead, I suspect it is related event handling and drawing. Yes, #1849 seems a likelier candidate. @digitalnumeric can you check that directly? Or bisect?

@tacaswell
Copy link
Member

#1849 was closed with out being merged as near as I can tell...

@efiring
Copy link
Member
efiring commented Feb 17, 2015

Oops! You are right, of course.

@digitalnumeric
Copy link
Author

I verified the issue on a second Windows 7 machine this morning. I did a fresh Python 2.7.9 install with mpl 1.4 and verfied the issue was present. I then uninstalled mpl 1.4 and installed mpl 1.2.1 and the issue was gone.

I haven't been able to re-create the issue in a simple form other than switching from my actual data to a sine wave which gives the same results. The image below shows how the zoom window just stays on the screen but zooming does not occur.
zoom_window

If I do a zoom the rectangle stays and the UI does not update. If I click pan in the toolbar then left click and begin to drag the mouse the previous zoom takes effect immediately then the pan continues.

It seems like the canvas (and maybe toolbar) are not communicating or not updating on windows events.

Was something changed in mpl in the way windows events were handled with the figure/canvas/navigation after 1.2.1 was released?

@digitalnumeric
Copy link
Author

FYI: I tried to access the 1.4.3 link tacaswell provided but I got "The sourceforge.net website is temporarily in static offline mode." It looks like Christoph Gohlke site has it so I will get it from there to test with.

@digitalnumeric
Copy link
Author

Question: For mpl is there any benefit to using an exe installer over a wheel (whl)? Does the exe do anything other than copy files to the correct location?

@mdboom
Copy link
Member
mdboom commented Feb 17, 2015

Cc: @cgohlke on the Windows question.

@digitalnumeric
Copy link
Author

I installed a 1.4.3 wheel from Christoph Gohlke's site and the issue is gone. Below is am image showing the zoom windows. After I released the mouse button it zoomed as expected.
zoom_window2

The home 8000 and back buttons work now as well. I see the zoom window has changed from a black rectangle to a purple translucent window. Nice. What else could have changed between 1.4.2 and 1.4.3 that could have made the issue go away?

That main issue is gone but a smaller zoom related one has now appeared. I have two subplots.

self.axes_1 = self.figure.add_subplot(211)
self.axes_2 = self.figure.add_subplot(212) 

Zooming in the top window the purple zoom rectangle is always drawn. Zooming in the bottom rectangle the purple zoom window is only sometimes drawn. I verified this on two machines.

@digitalnumeric
Copy link
Author

Update: I have another graph with 3 subplots.

self.axes_1 = self.figure.add_subplot(311)
self.axes_2 = self.figure.add_subplot(312)
self.axes_3 = self.figure.add_subplot(313)

Zooming on the first/top two always draws the purple zoomed rectangle. The last one (bottom one) only draws it sometimes. They all always zoom, but the rectangle is not always drawn for the bottom graph. It is intermittent.

@tacaswell
Copy link
Member

@RobinD42 Any advice?

@RobinD42
Copy link
Contributor

Nothing comes to mind at the moment. Is there a small runnable sample that can be used to demonstrate the problem?

@petehuang
Copy link
Contributor

Pinging again to repeat @RobinD42's request - is there a self-contained snippet we can run to re/confirm the issue?

@anntzer
Copy link
Contributor
anntzer commented Dec 15, 2017

Closing as the main issue appears to be solved and there is no repro for the second issue.
Feel free to request a reopen with additional information.

@anntzer anntzer closed this as completed Dec 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants
0