Kit
Kit

Reputation: 31513

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.

Upvotes: 2

Views: 1669

Answers (2)

Frank Niessink
Frank Niessink

Reputation: 1611

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.

Upvotes: 2

Anurag Uniyal
Anurag Uniyal

Reputation: 88757

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

Upvotes: 0

Related Questions