-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Updated WxAgg NavigationToolbar2 breaks custom toolbars #18212
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
Comments
There are a couple ways I've thought of this could be fixed, neither of them particularly hard. If someone tells me what the preferred option is, or suggests another option, I'm happy to do the coding and make a pull request. Option 1: Option 2: I prefer option 1, because that provides a clean API for those who don't want the cursor readout. Option 2 would require anyone who wants to do this to go digging around in the backend code. However, I don't know if there are constraints on the API for these NavigationToolbars in general across backends that might make that a less appealing option. |
Option 1 is better here, it gives you a clean way out and will match the qt5 toolbar matplotlib/lib/matplotlib/backends/backend_qt5.py Lines 654 to 655 in 7b56226
I do not disagree that |
Note, we would like to release 3.3.1 in a day or two, if you could get that PR in soonish. |
Bug report
Bug summary
In matplotlib 3.3, the WxAgg backend NavigationToolbar2 has added a readout of the cursor position on the far right of the toolbar. This breaks the layout of custom toolbars where users have added their own buttons or other widgets. Because the cursor position is added with a stretchspacer, any widget added after it as also added to the far right of the toolbar. In addition (possibly due to adding the custom widgets after the toolbar is initially realized?), the cursor readout can appear under the custom toolbar buttons.
Here's a custom toolbar from a program I maintain using matplotlib 3.3 and 3.2.2.
With 3.2.2:

With 3.3:

Code for reproduction
Actual outcome

Actual outcome with 3.3:
Expected outcome

Expected outcome (as with previous versions, using 3.2.2):
Matplotlib version
print(matplotlib.get_backend())
): WxAggEverything installed through conda. Matplotlib 3.2.2 installed from the main channel, 3.3.0 installed from conda-forge channel.
The text was updated successfully, but these errors were encountered: