hoffstadt / DearPyGui

Dear PyGui: A fast and powerful Graphical User Interface Toolkit for Python with minimal dependencies
https://dearpygui.readthedocs.io/en/latest/
MIT License
12.93k stars 675 forks source link

Support High DPI #1081

Open davidskeck opened 3 years ago

davidskeck commented 3 years ago

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

hoffstadt commented 3 years ago

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

ProfFan commented 3 years ago

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.

hskun commented 2 years ago

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