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

[Bug]: tkinter backend changes DPI awareness context of entire process on Windows #21875

Open
Labels
@daniilS

Description

@daniilS

Bug summary

_BackendTk.new_figure_manager_given_figure calls_c_internal_utils.Win32_SetProcessDpiAwareness_max, which affects the entire process attached to the script, and all windows part of it, rather than just the matplotlib output window.

Ideally, the DPI awareness context should only be changed for the current thread before a matplotlib window is drawn and returned to the previous value afterwards, or at the very least there should be an option to disable the DPI change.

Code for reproduction

# reproduces the bug when run on a high DPI display on Windowsimporttkinterastkfromtkinterimportttkimportmatplotlibmatplotlib.use('TkAgg')# in case other GUI libraries are installedimportmatplotlib.pyplotaspltroot=tk.Tk()button=ttk.Button(root,text="Run matplotlib.pyplot.subplots",command=plt.subplots)button.pack(padx=30,pady=30)root.wait_window()#root.mainloop seems to prevent DPI updates

Actual outcome

The scaling of the window changes.

Expected outcome

The scaling of the window shouldn't change just becausesubplots was called.

Additional information

Introduced in#19167

Operating system

Windows 10

Matplotlib Version

3.5.0

Matplotlib Backend

TkAgg

Python version

3.9.6

Jupyter version

No response

Installation

pip

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp