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)
| 69 | |
| 70 | |
| 71 | def 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 | |
| 88 | class MainFrame(wx.Frame): |