MCPcopy Create free account
hub / github.com/cztomczak/cefpython / scale_window_size_for_high_dpi

Function scale_window_size_for_high_dpi

examples/wxpython.py:71–85  ·  view source on GitHub ↗

Scale window size for high DPI devices. This func can be called on all operating systems, but scales only for Windows. If scaled value is bigger than the work area on the display then it will be reduced.

(width, height)

Source from the content-addressed store, hash-verified

69
70
71def scale_window_size_for_high_dpi(width, height):
72 """Scale window size for high DPI devices. This func can be
73 called on all operating systems, but scales only for Windows.
74 If scaled value is bigger than the work area on the display
75 then it will be reduced."""
76 if not WINDOWS:
77 return width, height
78 (_, _, max_width, max_height) = wx.GetClientDisplayRect().Get()
79 # noinspection PyUnresolvedReferences
80 (width, height) = cef.DpiAware.Scale((width, height))
81 if width > max_width:
82 width = max_width
83 if height > max_height:
84 height = max_height
85 return width, height
86
87
88class MainFrame(wx.Frame):

Callers 1

__init__Method · 0.85

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected