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

Fix and enhance High DPI support in wxpython.py example #399

Closed
cztomczak opened this issue Oct 1, 2017 · 1 comment
Closed

Fix and enhance High DPI support in wxpython.py example #399

cztomczak opened this issue Oct 1, 2017 · 1 comment
Milestone

Comments

@cztomczak
Copy link
Owner

cztomczak commented Oct 1, 2017

wxpython.py example enables High DPI support on Windows with this code:

if WINDOWS:
        # noinspection PyUnresolvedReferences, PyArgumentList
        cef.DpiAware.EnableHighDpiSupport()

However window size is not scaled during window creation, thus initial window size will be small on High DPI devices. The solution is to call cef.DpiAware.CalculateWindowSize(WIDTH, HEIGHT) and pass these new units to wx.Frame.__init__. Currently there is a bug and cef.DpiAware.CalculateWindowSize throws an error, this needs to be fixed in Issue #398. Temporarily you could use pywin32/ctypes extensions to get system dpi settings, this would require translating this C++ code to a Python equivalent:

void GetSystemDpi(int* dpix, int* dpiy) {

New window size should not exceed desktop work area (area without the taskbar etc). This working area can be fetched using wx.GetClientDisplayRect().Get().

@cztomczak cztomczak added this to the v66 milestone Aug 16, 2018
cztomczak added a commit that referenced this issue Aug 16, 2018
)

Fix DpiAware.GetSystemDpi, CalculateWindowSize (deprecated now).
Add DpiAware.Scale.
@cztomczak cztomczak changed the title Fix High DPI support in wxpython.py example Fix and enhance High DPI support in wxpython.py example Aug 16, 2018
@cztomczak
Copy link
Owner Author

Done in rev e6bcf2c.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant