DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

Support High DPI

Open davidskeck opened this issue 4 years ago • 6 comments

Is your feature request related to a problem? Please describe. Currently HiDPI mode on Pop!_OS results in a super tiny display for DPG windows.

Describe the solution you'd like Scale appropriately to HiDPI displays

Describe alternatives you've considered Add an additional config option perhaps that the script sets HiDPI mode itself.

Additional context Screenshot from 2021-07-18 17-15-31

davidskeck avatar Jul 18 '21 21:07 davidskeck

Wow. That's tiny. We will get on this! Thanks for the report!

hoffstadt avatar Jul 19 '21 01:07 hoffstadt

Just stumbled upon the same problem on Arch Linux. A simple patch

DearPyGui/src/platform/Linux/mvLinuxViewport.cpp
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
────────────────────┐
 namespace Marvel { │
────────────────────┘
132

         // Setup style
         ImGui::StyleColorsDark();
         auto& style = ImGui::GetStyle();
         style.ScaleAllSizes(2.0);
         mvApp::SetDefaultTheme();

         // Setup Platform/Renderer bindings

works locally if you are not redistributing. @davidskeck

Note for fonts to scale you need to add a custom font:

import dearpygui.dearpygui as dpg
from dearpygui.demo import show_demo

with dpg.font_registry():
    
    # add font (set as default for entire app)
    dpg.add_font("/usr/share/fonts/adobe-source-han-sans/SourceHanSansCN-Regular.otf", CURRENT_DPI * 13, default_font=True)

show_demo()
dpg.start_dearpygui()

For this to be cross-platform we need to detect the current DPI in the Viewport C++ files.

ProfFan avatar Jul 21 '21 01:07 ProfFan

include the icon texture(like the text font,radio etc.) in the hidpi resolution, when i scale 2x(windows 10),they look blur.

hskun avatar Oct 27 '21 02:10 hskun

Any fix? Having the same issue on a framework laptop with a hidpi (3:2 aspect ratio).

Image

Jimlarck avatar Apr 09 '25 02:04 Jimlarck

I still don't have a solution and see the same problem on the latest release. I'm not sure how @ProfFan made that change and rebuilt... any tips on how to get that to work? Thank you!

keck-in-space avatar Apr 23 '25 19:04 keck-in-space

OK I just went through the trouble of rebuilding DearPyGUI by following the steps in the CI to test the fix @ProfFan came up with, but appears it no longer works. Some impact occurs, but the only thing I can notice are my windows are slightly misplaced, rather than neatly arranged, but remain the same (tiny) size as before.

This is the change I tried:

--- a/src/mvViewport_linux.cpp
+++ b/src/mvViewport_linux.cpp
@@ -221,6 +221,8 @@ mvShowViewport(mvViewport& viewport, bool minimized, bool maximized)
 
     // Setup style
     ImGui::StyleColorsDark();
+    auto& style = ImGui::GetStyle();
+    style.ScaleAllSizes(2.0);
     SetDefaultTheme();
 
     // Setup Platform/Renderer bindings

keck-in-space avatar Apr 23 '25 19:04 keck-in-space