Skip to content

tk: Resize the canvas, not the figure. #16929

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

Merged
merged 1 commit into from
Mar 27, 2020
Merged

Conversation

QuLogic
Copy link
Member

@QuLogic QuLogic commented Mar 27, 2020

PR Summary

Resizing the figure directly does not account for the toolbar, so figures are actually a little shorter than they should be. The recent change to Text.get_window_extent some how causes this to actually get reflected in the Matplotlib figure size, which cycles back to Tk and shrinks the window. However, this can be triggered by other calls to Figure.set_size_inches as noted in the linked issues.

Fixes #10083.
Fixes #10566.
Fixes #16926.

PR Checklist

  • [n/a] Has Pytest style unit tests
  • Code is Flake 8 compliant
  • [n/a] New features are documented, with examples if plot related
  • [n/a] Documentation is sphinx and numpydoc compliant
  • [n/a] Added an entry to doc/users/next_whats_new/ if major new feature (follow instructions in README.rst there)
  • [n/a] Documented in doc/api/api_changes.rst if API changed in a backward-incompatible way

Resizing the figure directly does not account for the toolbar, so
figures are actually a little shorter than they should be. The recent
change to `Text.get_window_extent` some how causes this to actually get
reflected in the Matplotlib figure size, which cycles back to Tk and
shrinks the window. However, this can be triggered by other calls to
`Figure.set_size_inches` as noted in the fixed issues.

Fixes matplotlib#10083.
Fixes matplotlib#10566.
Fixes matplotlib#16926.
@QuLogic QuLogic added Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions. GUI: tk labels Mar 27, 2020
@QuLogic QuLogic requested a review from anntzer March 27, 2020 06:40
@QuLogic
Copy link
Member Author

QuLogic commented Mar 27, 2020

This could be backported to 3.2.2 if anyone feels strongly since it fixes other bugs, but it's not a regression, so it doesn't have to.

Copy link
Contributor

@anntzer anntzer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

works for me, and makes sense.

@dstansby dstansby added this to the v3.2.2 milestone Mar 27, 2020
@dstansby
Copy link
Member

Seems easy enough to backport, so I've tagged as 3.2.

@dstansby dstansby merged commit d9b722f into matplotlib:master Mar 27, 2020
meeseeksmachine pushed a commit to meeseeksmachine/matplotlib that referenced this pull request Mar 27, 2020
timhoffm added a commit that referenced this pull request Mar 27, 2020
…929-on-v3.2.x

Backport PR #16929 on branch v3.2.x (tk: Resize the canvas, not the figure.)
@QuLogic QuLogic deleted the tk-resize branch March 27, 2020 20:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GUI: tk Release critical For bugs that make the library unusable (segfaults, incorrect plots, etc) and major regressions.
Projects
None yet
3 participants