Skip to content

Commit be10dba

Browse files
committed
Add high dpi support in wxpython example (cztomczak#269)
1 parent a6c0a0a commit be10dba

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

examples/wxpython.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# To install wxPython on Linux type "sudo apt-get install python-wxtools".
55

66
# Tested with wxPython 2.8 on Linux, wxPython 3.0 on Windows/Mac
7-
# and CEF Python v55.3.
7+
# and CEF Python v55.3+.
88

99
import wx
1010
from cefpython3 import cefpython as cef
@@ -22,7 +22,15 @@
2222
def main():
2323
check_versions()
2424
sys.excepthook = cef.ExceptHook # To shutdown all CEF processes on error
25-
cef.Initialize()
25+
settings = {}
26+
if WINDOWS:
27+
# High DPI support
28+
settings["auto_zooming"] = "system_dpi"
29+
# Embed DPI awareness xml manifest inside .exe (recommended,
30+
# most reliable) or call the SetProcessDpiAware function.
31+
# noinspection PyUnresolvedReferences
32+
cef.DpiAware.SetProcessDpiAware()
33+
cef.Initialize(settings=settings)
2634
app = CefApp(False)
2735
app.MainLoop()
2836
del app # Must destroy before calling Shutdown

0 commit comments

Comments
 (0)