开发者

How do I get the screen DPI using wxPython?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜