Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix: Fix unstable tkagg small plot size.#29989

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
sandyowlet wants to merge1 commit intomatplotlib:main
base:main
Choose a base branch
Loading
fromsandyowlet:bugfix/issue-28330

Conversation

sandyowlet
Copy link
Contributor

PR summary

Closes#28330 .

image
Before: Left After: Right

417524558-869502a2-fd5e-4343-b741-2a7f237e5c1c

PR checklist

@sandyowletsandyowlet deleted the bugfix/issue-28330 branchApril 30, 2025 06:13
@sandyowletsandyowlet restored the bugfix/issue-28330 branchApril 30, 2025 06:18
@dstansby
Copy link
Member

Thanks for the fix, it looks good to me. Could you add a comment in the code, since I don't think it's super obvious whatpack_propagate() is achieving here. Something like# Don't resize the toolbar when mouse coordinates are shown or not shown.

@dstansbydstansby modified the milestones:v3.10.2,v3.10.3May 5, 2025
@sandyowlet
Copy link
ContributorAuthor

Thanks for the fix, it looks good to me. Could you add a comment in the code, since I don't think it's super obvious whatpack_propagate() is achieving here. Something like# Don't resize the toolbar when mouse coordinates are shown or not shown.

How about this:

         tk.Frame.__init__(self, master=window, borderwidth=2,                           width=int(canvas.figure.bbox.width), height=50)+        # Avoid message_label expanding the toolbar size, and in turn expanding+        # the canvas size. When the user defines a small figure size(e.g. 2x2),+        # this will cause:+        # 1. Figure size that is bigger than the user's expectation.+        # 2. When message_label is refreshed by mouse enter/leave, the canvas+        #    size will also be changed.         self.pack_propagate(False)

@timhoffm
Copy link
Member

Basically yes. A bit clearer

... Without pack_propergate(False), when the user defines a small figure size(e.g. 2x2),

@QuLogic
Copy link
Member

Did we also want to shrink the toolbar height, as noted in#28330 (comment)?

@timhoffm
Copy link
Member

Did we also want to shrink the toolbar height, as noted in#28330 (comment)?

I'd be in favor of that.

@sandyowlet
Copy link
ContributorAuthor

sandyowlet commentedMay 19, 2025
edited
Loading

Did we also want to shrink the toolbar height, as noted in#28330 (comment)?

Sorry, I used to think this display issue was simply due to the height of the toolbar.
However, after testing in both Windows and Linux environments, it seems to be related to DPI scaling.

(windows)
image

(linux)
image

When the scaling is set to 150% on windows, canvas is resized to 300 * 300, but the toolbar is resized to 300 * 50.
And on linux, the canvas is resized to 300 * 300 and toolbar is resized to 300 * 75.

This makes the appearance on Windows as expected, but not on Linux.

I'm not very clear on how rescaling works with TkAgg. Does anyone have experience with this?

@timhoffm
Copy link
Member

I'm not an expert on this, but the relevant starting point in our code base is here:

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@dstansbydstansbydstansby approved these changes

Assignees
No one assigned
Labels
Projects
None yet
Milestone
v3.10.4
Development

Successfully merging this pull request may close these issues.

[Bug]: unstabletkagg small plot size window
4 participants
@sandyowlet@dstansby@timhoffm@QuLogic

[8]ページ先頭

©2009-2025 Movatter.jp