Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x_pos doesn't work on viewport with high-res display (Windows) #2362

Open
v-ein opened this issue Jul 13, 2024 · 0 comments
Open

x_pos doesn't work on viewport with high-res display (Windows) #2362

v-ein opened this issue Jul 13, 2024 · 0 comments
Labels
state: pending not addressed yet type: bug bug

Comments

@v-ein
Copy link
Contributor

v-ein commented Jul 13, 2024

Version of Dear PyGui

Version: 1.11.1
Operating System: Windows 10 (10.0.19045).

My Issue/Question

When UI scaling is set to 200% in Windows, DPG viewport sticks to the left edge of the screen no matter what x_pos is specified for the viewport.

Reported in this Discord thread:
https://discord.com/channels/736279277242417272/1142953321821372550/1259654875193802864

Probably caused by get_horizontal_shift in mvViewport_win32.cpp: it seems to be unaware that GetWindowRect is affected by DPI scaling, whereas DwmGetWindowAttribute is not. Therefore DPI scaling probably affects the overall result, though I don't see how it can produce large enough offset.

Another hypothesis is that GetWindowRect fails for some reason, and window_rectangle remains uninitialized, which yields random garbage in the return value.

To Reproduce

TBD

Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

x_pos placing the viewport at the specified position.

Screenshots/Video

TBD

Standalone, minimal, complete and verifiable example

TBD

# Here's some code anyone can copy and paste to reproduce your issue
import dearpygui.dearpygui as dpg

dpg.create_context()
dpg.create_viewport()
dpg.setup_dearpygui()

with dpg.window(label="tutorial"):
    dpg.add_button(label="Press me")

more_code_to_explain_my_issue()

dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
@v-ein v-ein added state: pending not addressed yet type: bug bug labels Jul 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
state: pending not addressed yet type: bug bug
Projects
None yet
Development

No branches or pull requests

1 participant