Skip to content

[Bug]: Inconsistent size/padx for spacers in NavigationToolbar2Tk._rescale and _Spacer #25365

Closed
@anntzer

Description

@anntzer

Bug summary

NavigationToolbar2Tk._Spacer sets the spacer size to 18p and the padx to 3p, but _rescale sets them to 22p and 4p respectively.

Code for reproduction

# in ipython, tk backend
from pylab import *

plot(); show()

# In theory this should be triggered upon moving the window
# to a monitor with a different dpi, which I don't have,
# but one can also call _rescale manually
gcf().canvas.toolbar._rescale()

Actual outcome

The spacer becomes larger and with more space around it.

Expected outcome

No change to spacer size(?)

Additional information

I stumbled upon this while considering whether we could entirely get rid of _Spacer() and just add a RIDGE Frame instead and rely on _rescale() to set the size of the spacer as needed; the idea being to avoid the call to a private method in the https://matplotlib.org/stable/gallery/user_interfaces/mplcvd.html example while also not adding a new method for adding spacers.

Operating system

No response

Matplotlib Version

3.7

Matplotlib Backend

tkagg

Python version

3.11

Jupyter version

No response

Installation

git checkout

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions