开发者

How do I get the screen DPI using wxPython?

开发者 https://www.devze.com 2023-01-05 10:39 出处:网络
I can get the screen resolution in with开发者_运维问答 wx.DisplaySize() but I don\'t see a method which gives me the DPI.An easier solution may be:

I can get the screen resolution in with开发者_运维问答

wx.DisplaySize()

but I don't see a method which gives me the DPI.


An easier solution may be:

import wx
app = wx.App(0)
print wx.ScreenDC().GetPPI()

I tested it on Windows XP and it indeed prints (96, 96) with the default DPI-setting and (120, 120) with 120 DPI-setting.


I don't think there is any such function in wxPython, what you can do instead is, by using ctypes call win32api function GetDeviceCaps and get LOGPIXELSX/LOGPIXELSY

0

精彩评论

暂无评论...
验证码 换一张
取 消