Skip to content

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

Merged
dstansby merged 1 commit into
matplotlib:masterfrom
QuLogic:tk-resize
Mar 27, 2020
Merged

dstansby merged 1 commit into
matplotlib:masterfrom
QuLogic:tk-resize

Conversation

@QuLogic

@QuLogic QuLogic commented Mar 27, 2020

Copy link
Copy Markdown
Member

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

QuLogic commented Mar 27, 2020

Copy link
Copy Markdown
Member Author

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.

@anntzer anntzer left a comment •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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