Hi there,
I have a question concerning using high-resolution bitmaps with macOS and retina screens.
It seems there is support for this in wxWidgets, somewhat automagically, by putting a regular resolution e.g. “image.png” source file and also a 2x resolution e.g. “image@2x.png” source file next to it in the same directory. The code seems to indicate that if wxWidgets finds a retina screen and a version of the png file with @2x in the filename, then it will automatically use the @2x higher-resolution version of the image.
https://github.com/wxWidgets/wxWidgets/blob/master/src/osx/core/bitmap.cpp#L1143
I can’t get this to work with wxPython, even though it seems the above wxWidgets code is in the version that wxPython uses.
Question 1: Should this work in wxPython? Is there something I’m not doing right?
Question 2: I notice that the wxWidgets code is wrapped in an #if wxUSE_IMAGE, and furthermore that wxPython’s build_wxwidgets.py doesn’t seem to use wxUSE_IMAGE. Is this why I can’t get it to work with wxPython? Is there a reason not to use the option wxUSE_IMAGE?
There was another post in wxpython-users about this too: https://groups.google.com/forum/#!topic/wxpython-users/EV5rOSohRCE
thanks much for the info,
Matt
I have never done this as I don't regularly use Mac Os, so I can just summarize what I have found when working on the wx backend for matplotlib.
Usually, for a C++ wx application, you would need to have a info.plist file and define "NSPrincipalClass" to activate full retina support. I don't know whether the @2 icons should work without that. Maybe you can try to build wxPython with wxUSE_IMAGE, "compile" an executable and define a info.plist for that.
See also the last messeages of this thread:
https://groups.google.com/forum/#!topic/wx-dev/en7oPeUiV9A
From looking at e.g. the Qt backend of matplotlib, there must be a way to enable Retina support for a Python program without info.plist, but this is probably hidden deep inside the Qt sources. It would be great if wxPython could support HiDPI displays as well.
Regards,
Dietmar
···
On 5/19/2018 4:34 AM, itsayellow@gmail.com wrote:
Question 1: Should this work in wxPython? Is there something I'm not doing right?
Hi Dietmar, thanks for the notes.
I do have a python app frozen into a proper macOS application that indeed does have the “NSPrincipleClass”, and yet still no luck.
Also the wxpython-users thread I posted a link to indicates that the guy got @2x working when he recompiled wxWidgets himself instead of using the wxPython stock build of it. That made me wonder if it was possibly just that the wxUSE_IMAGE wasn’t enabled.
···
On Saturday, May 19, 2018 at 5:36:02 AM UTC-7, Dietmar Schwertberger wrote:
On 5/19/2018 4:34 AM, itsay...@gmail.com wrote:
Question 1: Should this work in wxPython? Is there something I’m not
doing right?
I have never done this as I don’t regularly use Mac Os, so I can just
summarize what I have found when working on the wx backend for matplotlib.
Usually, for a C++ wx application, you would need to have a info.plist
file and define “NSPrincipalClass” to activate full retina support. I
don’t know whether the @2 icons should work without that. Maybe you can
try to build wxPython with wxUSE_IMAGE, “compile” an executable and
define a info.plist for that.
See also the last messeages of this thread:
https://groups.google.com/forum/#!topic/wx-dev/en7oPeUiV9A
From looking at e.g. the Qt backend of matplotlib, there must be a way
to enable Retina support for a Python program without info.plist, but
this is probably hidden deep inside the Qt sources. It would be great if
wxPython could support HiDPI displays as well.
Regards,
Dietmar