Why Does Using the Qt Backend in Matplotlib Change DPI in Jupyter?

Switching matplotlib to its Qt mode in a Jupyter Notebook unexpectedly alters Tk DPI and screen dimensions. For example:

import tkinter as tk_alias
main_window = tk_alias.Tk()
current_dpi = main_window.winfo_fpixels('1i')
print('Observed DPI:', current_dpi)

When using the Qt backend within Jupyter, the underlying graphics context and configuration of DPI settings can affect how other components, such as Tk, initialize. The Qt environment may adjust several parameters at startup, causing unexpected changes in the reported DPI for Tk instances. In one of my projects, similar issues occurred when switching between graphical backends, and it was often resolved by explicitly setting DPI values after switching. Ensuring that DPI values are reset or confirmed after backend changes can help stabilize the appearance across different interfaces.

i had similar issues with qt mode- dpi got all wonky. i fixed it by manually resetting dpi settings after switching backends. might be a good idea to explicitly set your screen dpi at startup to avoid these quirky changes.