You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
tk window immediately resizes down to zero-height upon showing up. #16926
This bisects to #16828 (attn @QuLogic), even though it's not clear how that's related... perhaps the dynamic changes to figure dpi confuse tk, but it's not clear why this is different from before?
So it seems that's not it, as I can never trigger a case where dpi is not None, but self.figure.dpi is None (or something other than dpi). The strange thing is that if I print out all the properties that would be changed in Figure._set_dpi, nothing changes. So neither the forward call to Figure.set_size_inches (which might hit the canvas/toolbar size), nor the callbacks for the dpi_changed event do this. Yet somehow on a later call, the size is smaller...
There's definitely something else weird going on; if you add an extra dpi changed on the old code:
then there will be one call to Figure.set_size_inches with [6.4 4.46], but it magically fixes itself. I'm guessing what happens is that since the dpi change in the Text.get_window_extent is part of the draw/stale mechanism, it is enough to propagate that height change.
Activity
[-]tkagg [/-][+]tk window immediately resizes down to zero-height upon showing up.[/+]QuLogic commentedon Mar 27, 2020
I'm guessing this is related to the flaky test on AppVeyor. The only thing that's hit by that test is the fix to
Text.get_window_extent: https://github.com/matplotlib/matplotlib/pull/16828/files#diff-15e8fbe2a4d40deb738e8627eba02318L894My best guess is that
figure.dpihas never been correctly set, and it's been relying on this accidental change to do so.QuLogic commentedon Mar 27, 2020
So it seems that's not it, as I can never trigger a case where
dpi is not None, butself.figure.dpi is None(or something other thandpi). The strange thing is that if I print out all the properties that would be changed inFigure._set_dpi, nothing changes. So neither the forward call toFigure.set_size_inches(which might hit the canvas/toolbar size), nor the callbacks for thedpi_changedevent do this. Yet somehow on a later call, the size is smaller...There's definitely something else weird going on; if you add an extra dpi changed on the old code:
then there will be one call to
Figure.set_size_incheswith[6.4 4.46], but it magically fixes itself. I'm guessing what happens is that since the dpi change in theText.get_window_extentis part of the draw/stale mechanism, it is enough to propagate that height change.FBIShowYourHand commentedon Mar 27, 2020
a question about how to use Chinese,when I want to show Chinese,it always shows me errors,thanks
tk: Resize the canvas, not the figure.
tacaswell commentedon Mar 27, 2020
was #16828 backported to the v3.2.x branch?
tacaswell commentedon Mar 27, 2020
Ah, I understand now, not a regression on 3.2.x, but was backported there because it fixed some other bugs.
QuLogic commentedon Mar 28, 2020
You're right though; this bug was never in 3.2, so this issue shouldn't be tagged on it.
tk: Resize the canvas, not the figure.