I tried to build a simple UI on a ‘retina’ Macbook Pro, using wxpython ‘3.0.3.dev2043+6aacc38’. wxpython seems to have some problems detecting the resolution of the screen.
-
When I try to create a retina-resolution wx.adv.TaskBarIcon on the menu bar (using TBI_CUSTOM_STATUSITEM), the icon is down sampled from 32x32 to 16x16 before it is displayed.
-
When I create a wx.Frame, the frame is correctly displayed at retina resolution, but if I query the resolution with frame.GetContentScaleFactor(), it returns 1.00.
It seems like wx is failing to correctly detect the screen resolution.
Ben
Here is the code:
import wx
from wx.adv import TaskBarIcon, TBI_CUSTOM_STATUSITEM
app = wx.App(False)
statusicon.png is a 32x32 pixel png, but using the following code
it gets downsampled to 16x16 before it appears on the menu bar
icon_file = icon_file = ‘statusicon.png’
icon = wx.Icon(icon_file, wx.BITMAP_TYPE_ANY)
TaskBarIcon(TBI_CUSTOM_STATUSITEM).SetIcon(icon)
This frame appears in retina resolution,
suggesting that it is using a scale factor of 2, but
but GetContentScaleFactor, returns 1.00
frame = wx.Frame(None, wx.ID_ANY, “Window”)
frame.Show(True)
sf = frame.GetContentScaleFactor()
wx.MessageDialog(None, ‘frame.GetContentScaleFactor()=%f’ % sf).ShowModal()