Retina images in wxPython

Hi everyone,

I understand wxPython has support for retina text, but no matter what I do I cannot get retina support working for images.

Does anyone have an idea on how to get it to work if possible? Do I need to patch wxWidgets and rebuild wxPython? Whats the least version that supports retina?

If anyone has a sample demo script that works I’d appreciate an example.

Thanks,

-R

Hi,

Hi everyone,

I understand wxPython has support for retina text, but no matter what I do I
cannot get retina support working for images.

Does anyone have an idea on how to get it to work if possible? Do I need to
patch wxWidgets and rebuild wxPython? Whats the least version that supports
retina?

If anyone has a sample demo script that works I'd appreciate an example.

What is your {wx}python versions?
What OSX version?
Are you sure you have a Retina display?

Thank you.

···

On Mon, May 22, 2017 at 3:13 PM, Rishi Sharma <rishsharma@gmail.com> wrote:

Thanks,

-R

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi!

I have a Macbook Pro Retina Touchbar. I made sure the screen is set to Default.

This is what I have found so far. I’m using wxPython 3.0.1.0 (although I’ve tried to use the 4.0 version as well). Below is a sample script I wrote (requires AppKit PyObjC to check for backingScaleFactor). I made sure to look at the backingScaleFactor and found it correctly it returns 2. I’m looking at the bitmap code block and do see support:

if ( type == wxBITMAP_TYPE_PNG )

{

if ( wxOSXGetMainScreenContentScaleFactor() > 1.9 )

{

wxFileName fn(filename);

fn.MakeAbsolute();

fn.SetName(fn.GetName()+"@2x");

if ( fn.Exists() )

{

fname = fn.GetFullPath();

scale = 2.0;

}

}

}

I just have no idea why its not working. Here is the sample:

import AppKit as AK

import wx

class MyFrame(wx.Frame):

def init(self, parent):

wx.Frame.init(self, parent, -1, “Retina Demo”)

print AK.NSScreen.screens()[0].backingScaleFactor()

path = “img.png”

bmp = wx.EmptyBitmap( 1, 1 )

bmp.LoadFile(path, wx.BITMAP_TYPE_PNG)

bmp = wx.StaticBitmap(self, -1, bmp)

sizer = wx.BoxSizer(wx.VERTICAL)

sizer.Add(bmp, 1, wx.ALL|wx.EXPAND, 5)

self.SetSizer(sizer)

sizer.Fit(self)

self.Layout()

app = wx.App()

frame = MyFrame(None)

app.SetTopWindow(frame)

frame.Show()

app.MainLoop()

···

On Mon, May 22, 2017 at 12:20 PM, Igor Korot ikorot01@gmail.com wrote:

Hi,

On Mon, May 22, 2017 at 3:13 PM, Rishi Sharma rishsharma@gmail.com wrote:

Hi everyone,

I understand wxPython has support for retina text, but no matter what I do I

cannot get retina support working for images.

Does anyone have an idea on how to get it to work if possible? Do I need to

patch wxWidgets and rebuild wxPython? Whats the least version that supports

retina?

If anyone has a sample demo script that works I’d appreciate an example.

What is your {wx}python versions?

What OSX version?

Are you sure you have a Retina display?

Thank you.

Thanks,

-R

You received this message because you are subscribed to the Google Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

In order to test it uses the correct image, I have img.png and img@2x.png (both are actually different images so I can tell which one is loaded).

···

On Mon, May 22, 2017 at 1:02 PM, Rishi Sharma rishsharma@gmail.com wrote:

Hi!

I have a Macbook Pro Retina Touchbar. I made sure the screen is set to Default.

This is what I have found so far. I’m using wxPython 3.0.1.0 (although I’ve tried to use the 4.0 version as well). Below is a sample script I wrote (requires AppKit PyObjC to check for backingScaleFactor). I made sure to look at the backingScaleFactor and found it correctly it returns 2. I’m looking at the bitmap code block and do see support:

if ( type == wxBITMAP_TYPE_PNG )

{

if ( wxOSXGetMainScreenContentScaleFactor() > 1.9 )

{

wxFileName fn(filename);

fn.MakeAbsolute();

fn.SetName(fn.GetName()+"@2x");

if ( fn.Exists() )

{

fname = fn.GetFullPath();

scale = 2.0;

}

}

}

I just have no idea why its not working. Here is the sample:

import AppKit as AK

import wx

class MyFrame(wx.Frame):

def init(self, parent):

wx.Frame.init(self, parent, -1, “Retina Demo”)

print AK.NSScreen.screens()[0].backingScaleFactor()

path = “img.png”

bmp = wx.EmptyBitmap( 1, 1 )

bmp.LoadFile(path, wx.BITMAP_TYPE_PNG)

bmp = wx.StaticBitmap(self, -1, bmp)

sizer = wx.BoxSizer(wx.VERTICAL)

sizer.Add(bmp, 1, wx.ALL|wx.EXPAND, 5)

self.SetSizer(sizer)

sizer.Fit(self)

self.Layout()

app = wx.App()

frame = MyFrame(None)

app.SetTopWindow(frame)

frame.Show()

app.MainLoop()

On Mon, May 22, 2017 at 12:20 PM, Igor Korot ikorot01@gmail.com wrote:

Hi,

On Mon, May 22, 2017 at 3:13 PM, Rishi Sharma rishsharma@gmail.com wrote:

Hi everyone,

I understand wxPython has support for retina text, but no matter what I do I

cannot get retina support working for images.

Does anyone have an idea on how to get it to work if possible? Do I need to

patch wxWidgets and rebuild wxPython? Whats the least version that supports

retina?

If anyone has a sample demo script that works I’d appreciate an example.

What is your {wx}python versions?

What OSX version?

Are you sure you have a Retina display?

Thank you.

Thanks,

-R

You received this message because you are subscribed to the Google Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Hi,

In order to test it uses the correct image, I have img.png and img@2x.png
(both are actually different images so I can tell which one is loaded).

Are they both accessible?
Just for the test - can you try to load both of them and check that
the bitmap IsOk()
returns true?

Thank you.

···

On Mon, May 22, 2017 at 4:03 PM, Rishi Sharma <rishsharma@gmail.com> wrote:

On Mon, May 22, 2017 at 1:02 PM, Rishi Sharma <rishsharma@gmail.com> wrote:

Hi!

I have a Macbook Pro Retina Touchbar. I made sure the screen is set to
Default.

This is what I have found so far. I'm using wxPython 3.0.1.0 (although
I've tried to use the 4.0 version as well). Below is a sample script I
wrote (requires AppKit PyObjC to check for backingScaleFactor). I made sure
to look at the backingScaleFactor and found it correctly it returns 2. I'm
looking at the bitmap code block and do see support:

        if ( type == wxBITMAP_TYPE_PNG )
        {
            if ( wxOSXGetMainScreenContentScaleFactor() > 1.9 )
            {
                wxFileName fn(filename);
                fn.MakeAbsolute();
                fn.SetName(fn.GetName()+"@2x");

                if ( fn.Exists() )
                {
                    fname = fn.GetFullPath();
                    scale = 2.0;
                }
            }
        }

I just have no idea why its not working. Here is the sample:

import AppKit as AK
import wx

class MyFrame(wx.Frame):
  def __init__(self, parent):
    wx.Frame.__init__(self, parent, -1, "Retina Demo")
    print AK.NSScreen.screens()[0].backingScaleFactor()
    path = "img.png"
    bmp = wx.EmptyBitmap( 1, 1 )
    bmp.LoadFile(path, wx.BITMAP_TYPE_PNG)
    bmp = wx.StaticBitmap(self, -1, bmp)
    sizer = wx.BoxSizer(wx.VERTICAL)
    sizer.Add(bmp, 1, wx.ALL|wx.EXPAND, 5)
    self.SetSizer(sizer)
    sizer.Fit(self)
    self.Layout()

app = wx.App()
frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()
app.MainLoop()

On Mon, May 22, 2017 at 12:20 PM, Igor Korot <ikorot01@gmail.com> wrote:

Hi,

On Mon, May 22, 2017 at 3:13 PM, Rishi Sharma <rishsharma@gmail.com> >>> wrote:
> Hi everyone,
>
> I understand wxPython has support for retina text, but no matter what I
> do I
> cannot get retina support working for images.
>
> Does anyone have an idea on how to get it to work if possible? Do I
> need to
> patch wxWidgets and rebuild wxPython? Whats the least version that
> supports
> retina?
>
> If anyone has a sample demo script that works I'd appreciate an
> example.

What is your {wx}python versions?
What OSX version?
Are you sure you have a Retina display?

Thank you.

>
> Thanks,
>
> -R
>
> --
> You received this message because you are subscribed to the Google
> Groups
> "wxPython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an
> email to wxpython-users+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi,

> In order to test it uses the correct image, I have img.png and img@2x.png
> (both are actually different images so I can tell which one is loaded).

Are they both accessible?
Just for the test - can you try to load both of them and check that
the bitmap IsOk()
returns true?

Done, both return True. Are you able to get the 2x image loaded with the
script below (using substitute images)?

···

On Mon, May 22, 2017 at 1:11 PM, Igor Korot <ikorot01@gmail.com> wrote:

On Mon, May 22, 2017 at 4:03 PM, Rishi Sharma <rishsharma@gmail.com> > wrote:

Thank you.

>
> On Mon, May 22, 2017 at 1:02 PM, Rishi Sharma <rishsharma@gmail.com> > wrote:
>>
>> Hi!
>>
>> I have a Macbook Pro Retina Touchbar. I made sure the screen is set to
>> Default.
>>
>> This is what I have found so far. I'm using wxPython 3.0.1.0 (although
>> I've tried to use the 4.0 version as well). Below is a sample script I
>> wrote (requires AppKit PyObjC to check for backingScaleFactor). I made
sure
>> to look at the backingScaleFactor and found it correctly it returns 2.
I'm
>> looking at the bitmap code block and do see support:
>>
>> if ( type == wxBITMAP_TYPE_PNG )
>> {
>> if ( wxOSXGetMainScreenContentScaleFactor() > 1.9 )
>> {
>> wxFileName fn(filename);
>> fn.MakeAbsolute();
>> fn.SetName(fn.GetName()+"@2x");
>>
>> if ( fn.Exists() )
>> {
>> fname = fn.GetFullPath();
>> scale = 2.0;
>> }
>> }
>> }
>>
>> I just have no idea why its not working. Here is the sample:
>>
>> import AppKit as AK
>> import wx
>>
>> class MyFrame(wx.Frame):
>> def __init__(self, parent):
>> wx.Frame.__init__(self, parent, -1, "Retina Demo")
>> print AK.NSScreen.screens()[0].backingScaleFactor()
>> path = "img.png"
>> bmp = wx.EmptyBitmap( 1, 1 )
>> bmp.LoadFile(path, wx.BITMAP_TYPE_PNG)
>> bmp = wx.StaticBitmap(self, -1, bmp)
>> sizer = wx.BoxSizer(wx.VERTICAL)
>> sizer.Add(bmp, 1, wx.ALL|wx.EXPAND, 5)
>> self.SetSizer(sizer)
>> sizer.Fit(self)
>> self.Layout()
>>
>> app = wx.App()
>> frame = MyFrame(None)
>> app.SetTopWindow(frame)
>> frame.Show()
>> app.MainLoop()
>>
>> On Mon, May 22, 2017 at 12:20 PM, Igor Korot <ikorot01@gmail.com> > wrote:
>>>
>>> Hi,
>>>
>>> On Mon, May 22, 2017 at 3:13 PM, Rishi Sharma <rishsharma@gmail.com> > >>> wrote:
>>> > Hi everyone,
>>> >
>>> > I understand wxPython has support for retina text, but no matter
what I
>>> > do I
>>> > cannot get retina support working for images.
>>> >
>>> > Does anyone have an idea on how to get it to work if possible? Do I
>>> > need to
>>> > patch wxWidgets and rebuild wxPython? Whats the least version that
>>> > supports
>>> > retina?
>>> >
>>> > If anyone has a sample demo script that works I'd appreciate an
>>> > example.
>>>
>>> What is your {wx}python versions?
>>> What OSX version?
>>> Are you sure you have a Retina display?
>>>
>>> Thank you.
>>>
>>> >
>>> > Thanks,
>>> >
>>> > -R
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "wxPython-users" group.
>>> > To unsubscribe from this group and stop receiving emails from it,
send
>>> > an
>>> > email to wxpython-users+unsubscribe@googlegroups.com.
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
Groups
>>> "wxPython-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
an
>>> email to wxpython-users+unsubscribe@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>
> --
> You received this message because you are subscribed to the Google Groups
> "wxPython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to wxpython-users+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi,

Hi,

> In order to test it uses the correct image, I have img.png and
> img@2x.png
> (both are actually different images so I can tell which one is loaded).

Are they both accessible?
Just for the test - can you try to load both of them and check that
the bitmap IsOk()
returns true?

Done, both return True. Are you able to get the 2x image loaded with the
script below (using substitute images)?

I don't have Mac with Retina.
Now you can successfully render the "@2" bitmap into the screen, right?
Maybe wxPython does not compile this code?

Thank you.

···

On Mon, May 22, 2017 at 4:44 PM, Rishi Sharma <rishsharma@gmail.com> wrote:

On Mon, May 22, 2017 at 1:11 PM, Igor Korot <ikorot01@gmail.com> wrote:

On Mon, May 22, 2017 at 4:03 PM, Rishi Sharma <rishsharma@gmail.com> >> wrote:

Thank you.

>
> On Mon, May 22, 2017 at 1:02 PM, Rishi Sharma <rishsharma@gmail.com> >> > wrote:
>>
>> Hi!
>>
>> I have a Macbook Pro Retina Touchbar. I made sure the screen is set to
>> Default.
>>
>> This is what I have found so far. I'm using wxPython 3.0.1.0 (although
>> I've tried to use the 4.0 version as well). Below is a sample script I
>> wrote (requires AppKit PyObjC to check for backingScaleFactor). I made
>> sure
>> to look at the backingScaleFactor and found it correctly it returns 2.
>> I'm
>> looking at the bitmap code block and do see support:
>>
>> if ( type == wxBITMAP_TYPE_PNG )
>> {
>> if ( wxOSXGetMainScreenContentScaleFactor() > 1.9 )
>> {
>> wxFileName fn(filename);
>> fn.MakeAbsolute();
>> fn.SetName(fn.GetName()+"@2x");
>>
>> if ( fn.Exists() )
>> {
>> fname = fn.GetFullPath();
>> scale = 2.0;
>> }
>> }
>> }
>>
>> I just have no idea why its not working. Here is the sample:
>>
>> import AppKit as AK
>> import wx
>>
>> class MyFrame(wx.Frame):
>> def __init__(self, parent):
>> wx.Frame.__init__(self, parent, -1, "Retina Demo")
>> print AK.NSScreen.screens()[0].backingScaleFactor()
>> path = "img.png"
>> bmp = wx.EmptyBitmap( 1, 1 )
>> bmp.LoadFile(path, wx.BITMAP_TYPE_PNG)
>> bmp = wx.StaticBitmap(self, -1, bmp)
>> sizer = wx.BoxSizer(wx.VERTICAL)
>> sizer.Add(bmp, 1, wx.ALL|wx.EXPAND, 5)
>> self.SetSizer(sizer)
>> sizer.Fit(self)
>> self.Layout()
>>
>> app = wx.App()
>> frame = MyFrame(None)
>> app.SetTopWindow(frame)
>> frame.Show()
>> app.MainLoop()
>>
>> On Mon, May 22, 2017 at 12:20 PM, Igor Korot <ikorot01@gmail.com> >> >> wrote:
>>>
>>> Hi,
>>>
>>> On Mon, May 22, 2017 at 3:13 PM, Rishi Sharma <rishsharma@gmail.com> >> >>> wrote:
>>> > Hi everyone,
>>> >
>>> > I understand wxPython has support for retina text, but no matter
>>> > what I
>>> > do I
>>> > cannot get retina support working for images.
>>> >
>>> > Does anyone have an idea on how to get it to work if possible? Do I
>>> > need to
>>> > patch wxWidgets and rebuild wxPython? Whats the least version that
>>> > supports
>>> > retina?
>>> >
>>> > If anyone has a sample demo script that works I'd appreciate an
>>> > example.
>>>
>>> What is your {wx}python versions?
>>> What OSX version?
>>> Are you sure you have a Retina display?
>>>
>>> Thank you.
>>>
>>> >
>>> > Thanks,
>>> >
>>> > -R
>>> >
>>> > --
>>> > You received this message because you are subscribed to the Google
>>> > Groups
>>> > "wxPython-users" group.
>>> > To unsubscribe from this group and stop receiving emails from it,
>>> > send
>>> > an
>>> > email to wxpython-users+unsubscribe@googlegroups.com.
>>> > For more options, visit https://groups.google.com/d/optout.
>>>
>>> --
>>> You received this message because you are subscribed to the Google
>>> Groups
>>> "wxPython-users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send
>>> an
>>> email to wxpython-users+unsubscribe@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>
> --
> You received this message because you are subscribed to the Google
> Groups
> "wxPython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an
> email to wxpython-users+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi,

>
>
>>
>> Hi,
>>
>> > In order to test it uses the correct image, I have img.png and
>> > img@2x.png
>> > (both are actually different images so I can tell which one is
loaded).
>>
>> Are they both accessible?
>> Just for the test - can you try to load both of them and check that
>> the bitmap IsOk()
>> returns true?
>
>
> Done, both return True. Are you able to get the 2x image loaded with the
> script below (using substitute images)?

I don't have Mac with Retina.
Now you can successfully render the "@2" bitmap into the screen, right?
Maybe wxPython does not compile this code?

Yeah, but its rendered scaled up for the 2.0 factor. I'm not sure how
wxPython would not compile the code since it seems to be in the wxwidgets
source included with it. I did originally download the binary though, so
perhaps something in the binary had it off.

I can't find a single success story about retina and wxPython via google so
not sure whats up.

···

On Mon, May 22, 2017 at 1:56 PM, Igor Korot <ikorot01@gmail.com> wrote:

On Mon, May 22, 2017 at 4:44 PM, Rishi Sharma <rishsharma@gmail.com> > wrote:
> On Mon, May 22, 2017 at 1:11 PM, Igor Korot <ikorot01@gmail.com> wrote:
>> On Mon, May 22, 2017 at 4:03 PM, Rishi Sharma <rishsharma@gmail.com> > >> wrote:

Thank you.

>
>>
>>
>> Thank you.
>>
>> >
>> > On Mon, May 22, 2017 at 1:02 PM, Rishi Sharma <rishsharma@gmail.com> > >> > wrote:
>> >>
>> >> Hi!
>> >>
>> >> I have a Macbook Pro Retina Touchbar. I made sure the screen is set
to
>> >> Default.
>> >>
>> >> This is what I have found so far. I'm using wxPython 3.0.1.0
(although
>> >> I've tried to use the 4.0 version as well). Below is a sample
script I
>> >> wrote (requires AppKit PyObjC to check for backingScaleFactor). I
made
>> >> sure
>> >> to look at the backingScaleFactor and found it correctly it returns
2.
>> >> I'm
>> >> looking at the bitmap code block and do see support:
>> >>
>> >> if ( type == wxBITMAP_TYPE_PNG )
>> >> {
>> >> if ( wxOSXGetMainScreenContentScaleFactor() > 1.9 )
>> >> {
>> >> wxFileName fn(filename);
>> >> fn.MakeAbsolute();
>> >> fn.SetName(fn.GetName()+"@2x");
>> >>
>> >> if ( fn.Exists() )
>> >> {
>> >> fname = fn.GetFullPath();
>> >> scale = 2.0;
>> >> }
>> >> }
>> >> }
>> >>
>> >> I just have no idea why its not working. Here is the sample:
>> >>
>> >> import AppKit as AK
>> >> import wx
>> >>
>> >> class MyFrame(wx.Frame):
>> >> def __init__(self, parent):
>> >> wx.Frame.__init__(self, parent, -1, "Retina Demo")
>> >> print AK.NSScreen.screens()[0].backingScaleFactor()
>> >> path = "img.png"
>> >> bmp = wx.EmptyBitmap( 1, 1 )
>> >> bmp.LoadFile(path, wx.BITMAP_TYPE_PNG)
>> >> bmp = wx.StaticBitmap(self, -1, bmp)
>> >> sizer = wx.BoxSizer(wx.VERTICAL)
>> >> sizer.Add(bmp, 1, wx.ALL|wx.EXPAND, 5)
>> >> self.SetSizer(sizer)
>> >> sizer.Fit(self)
>> >> self.Layout()
>> >>
>> >> app = wx.App()
>> >> frame = MyFrame(None)
>> >> app.SetTopWindow(frame)
>> >> frame.Show()
>> >> app.MainLoop()
>> >>
>> >> On Mon, May 22, 2017 at 12:20 PM, Igor Korot <ikorot01@gmail.com> > >> >> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> On Mon, May 22, 2017 at 3:13 PM, Rishi Sharma <rishsharma@gmail.com > > > >> >>> wrote:
>> >>> > Hi everyone,
>> >>> >
>> >>> > I understand wxPython has support for retina text, but no matter
>> >>> > what I
>> >>> > do I
>> >>> > cannot get retina support working for images.
>> >>> >
>> >>> > Does anyone have an idea on how to get it to work if possible? Do
I
>> >>> > need to
>> >>> > patch wxWidgets and rebuild wxPython? Whats the least version
that
>> >>> > supports
>> >>> > retina?
>> >>> >
>> >>> > If anyone has a sample demo script that works I'd appreciate an
>> >>> > example.
>> >>>
>> >>> What is your {wx}python versions?
>> >>> What OSX version?
>> >>> Are you sure you have a Retina display?
>> >>>
>> >>> Thank you.
>> >>>
>> >>> >
>> >>> > Thanks,
>> >>> >
>> >>> > -R
>> >>> >
>> >>> > --
>> >>> > You received this message because you are subscribed to the Google
>> >>> > Groups
>> >>> > "wxPython-users" group.
>> >>> > To unsubscribe from this group and stop receiving emails from it,
>> >>> > send
>> >>> > an
>> >>> > email to wxpython-users+unsubscribe@googlegroups.com.
>> >>> > For more options, visit https://groups.google.com/d/optout.
>> >>>
>> >>> --
>> >>> You received this message because you are subscribed to the Google
>> >>> Groups
>> >>> "wxPython-users" group.
>> >>> To unsubscribe from this group and stop receiving emails from it,
send
>> >>> an
>> >>> email to wxpython-users+unsubscribe@googlegroups.com.
>> >>> For more options, visit https://groups.google.com/d/optout.
>> >>
>> >>
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "wxPython-users" group.
>> > To unsubscribe from this group and stop receiving emails from it, send
>> > an
>> > email to wxpython-users+unsubscribe@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google
Groups
>> "wxPython-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send
an
>> email to wxpython-users+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "wxPython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to wxpython-users+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hi,

Hi,

>
>
>>
>> Hi,
>>
>> > In order to test it uses the correct image, I have img.png and
>> > img@2x.png
>> > (both are actually different images so I can tell which one is
>> > loaded).
>>
>> Are they both accessible?
>> Just for the test - can you try to load both of them and check that
>> the bitmap IsOk()
>> returns true?
>
>
> Done, both return True. Are you able to get the 2x image loaded with
> the
> script below (using substitute images)?

I don't have Mac with Retina.
Now you can successfully render the "@2" bitmap into the screen, right?
Maybe wxPython does not compile this code?

Yeah, but its rendered scaled up for the 2.0 factor. I'm not sure how
wxPython would not compile the code since it seems to be in the wxwidgets
source included with it. I did originally download the binary though, so
perhaps something in the binary had it off.

I can't find a single success story about retina and wxPython via google so
not sure whats up.

It is possible that wxPython release (code cut-off) was done prior to
this specific code
was put into wxWidgets.

Try building the wxWidgets Git HEAD along with wxPython Git HEAD and see if it
works.

Thank you.

···

On Mon, May 22, 2017 at 5:08 PM, Rishi Sharma <rishsharma@gmail.com> wrote:

On Mon, May 22, 2017 at 1:56 PM, Igor Korot <ikorot01@gmail.com> wrote:

On Mon, May 22, 2017 at 4:44 PM, Rishi Sharma <rishsharma@gmail.com> >> wrote:
> On Mon, May 22, 2017 at 1:11 PM, Igor Korot <ikorot01@gmail.com> wrote:
>> On Mon, May 22, 2017 at 4:03 PM, Rishi Sharma <rishsharma@gmail.com> >> >> wrote:

Thank you.

>
>>
>>
>> Thank you.
>>
>> >
>> > On Mon, May 22, 2017 at 1:02 PM, Rishi Sharma <rishsharma@gmail.com> >> >> > wrote:
>> >>
>> >> Hi!
>> >>
>> >> I have a Macbook Pro Retina Touchbar. I made sure the screen is set
>> >> to
>> >> Default.
>> >>
>> >> This is what I have found so far. I'm using wxPython 3.0.1.0
>> >> (although
>> >> I've tried to use the 4.0 version as well). Below is a sample
>> >> script I
>> >> wrote (requires AppKit PyObjC to check for backingScaleFactor). I
>> >> made
>> >> sure
>> >> to look at the backingScaleFactor and found it correctly it returns
>> >> 2.
>> >> I'm
>> >> looking at the bitmap code block and do see support:
>> >>
>> >> if ( type == wxBITMAP_TYPE_PNG )
>> >> {
>> >> if ( wxOSXGetMainScreenContentScaleFactor() > 1.9 )
>> >> {
>> >> wxFileName fn(filename);
>> >> fn.MakeAbsolute();
>> >> fn.SetName(fn.GetName()+"@2x");
>> >>
>> >> if ( fn.Exists() )
>> >> {
>> >> fname = fn.GetFullPath();
>> >> scale = 2.0;
>> >> }
>> >> }
>> >> }
>> >>
>> >> I just have no idea why its not working. Here is the sample:
>> >>
>> >> import AppKit as AK
>> >> import wx
>> >>
>> >> class MyFrame(wx.Frame):
>> >> def __init__(self, parent):
>> >> wx.Frame.__init__(self, parent, -1, "Retina Demo")
>> >> print AK.NSScreen.screens()[0].backingScaleFactor()
>> >> path = "img.png"
>> >> bmp = wx.EmptyBitmap( 1, 1 )
>> >> bmp.LoadFile(path, wx.BITMAP_TYPE_PNG)
>> >> bmp = wx.StaticBitmap(self, -1, bmp)
>> >> sizer = wx.BoxSizer(wx.VERTICAL)
>> >> sizer.Add(bmp, 1, wx.ALL|wx.EXPAND, 5)
>> >> self.SetSizer(sizer)
>> >> sizer.Fit(self)
>> >> self.Layout()
>> >>
>> >> app = wx.App()
>> >> frame = MyFrame(None)
>> >> app.SetTopWindow(frame)
>> >> frame.Show()
>> >> app.MainLoop()
>> >>
>> >> On Mon, May 22, 2017 at 12:20 PM, Igor Korot <ikorot01@gmail.com> >> >> >> wrote:
>> >>>
>> >>> Hi,
>> >>>
>> >>> On Mon, May 22, 2017 at 3:13 PM, Rishi Sharma >> >> >>> <rishsharma@gmail.com> >> >> >>> wrote:
>> >>> > Hi everyone,
>> >>> >
>> >>> > I understand wxPython has support for retina text, but no matter
>> >>> > what I
>> >>> > do I
>> >>> > cannot get retina support working for images.
>> >>> >
>> >>> > Does anyone have an idea on how to get it to work if possible? Do
>> >>> > I
>> >>> > need to
>> >>> > patch wxWidgets and rebuild wxPython? Whats the least version
>> >>> > that
>> >>> > supports
>> >>> > retina?
>> >>> >
>> >>> > If anyone has a sample demo script that works I'd appreciate an
>> >>> > example.
>> >>>
>> >>> What is your {wx}python versions?
>> >>> What OSX version?
>> >>> Are you sure you have a Retina display?
>> >>>
>> >>> Thank you.
>> >>>
>> >>> >
>> >>> > Thanks,
>> >>> >
>> >>> > -R
>> >>> >
>> >>> > --
>> >>> > You received this message because you are subscribed to the
>> >>> > Google
>> >>> > Groups
>> >>> > "wxPython-users" group.
>> >>> > To unsubscribe from this group and stop receiving emails from it,
>> >>> > send
>> >>> > an
>> >>> > email to wxpython-users+unsubscribe@googlegroups.com.
>> >>> > For more options, visit https://groups.google.com/d/optout.
>> >>>
>> >>> --
>> >>> You received this message because you are subscribed to the Google
>> >>> Groups
>> >>> "wxPython-users" group.
>> >>> To unsubscribe from this group and stop receiving emails from it,
>> >>> send
>> >>> an
>> >>> email to wxpython-users+unsubscribe@googlegroups.com.
>> >>> For more options, visit https://groups.google.com/d/optout.
>> >>
>> >>
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "wxPython-users" group.
>> > To unsubscribe from this group and stop receiving emails from it,
>> > send
>> > an
>> > email to wxpython-users+unsubscribe@googlegroups.com.
>> > For more options, visit https://groups.google.com/d/optout.
>>
>> --
>> You received this message because you are subscribed to the Google
>> Groups
>> "wxPython-users" group.
>> To unsubscribe from this group and stop receiving emails from it, send
>> an
>> email to wxpython-users+unsubscribe@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>
>
> --
> You received this message because you are subscribed to the Google
> Groups
> "wxPython-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an
> email to wxpython-users+unsubscribe@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups
"wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to wxpython-users+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

I checked the source for that version: https://cytranet.dl.sourceforge.net/project/wxpython/wxPython/3.0.1.0/wxPython-src-3.0.1.0.tar.bz2 and the code block is in there.

Additionally I tried the same script with 4.0a and it doesn’t work either (which undoubtedly would have the changes).

I’m trying to build that version but keep getting errors in wxWidgets. I guess I’m missing the “ar” utility need to build it. So more googling.

···

On Mon, May 22, 2017 at 2:34 PM, Igor Korot ikorot01@gmail.com wrote:

Hi,

On Mon, May 22, 2017 at 5:08 PM, Rishi Sharma rishsharma@gmail.com wrote:

On Mon, May 22, 2017 at 1:56 PM, Igor Korot ikorot01@gmail.com wrote:

Hi,

On Mon, May 22, 2017 at 4:44 PM, Rishi Sharma rishsharma@gmail.com

wrote:

On Mon, May 22, 2017 at 1:11 PM, Igor Korot ikorot01@gmail.com wrote:

Hi,

On Mon, May 22, 2017 at 4:03 PM, Rishi Sharma rishsharma@gmail.com

wrote:

In order to test it uses the correct image, I have img.png and

img@2x.png

(both are actually different images so I can tell which one is

loaded).

Are they both accessible?

Just for the test - can you try to load both of them and check that

the bitmap IsOk()

returns true?

Done, both return True. Are you able to get the 2x image loaded with

the

script below (using substitute images)?

I don’t have Mac with Retina.

Now you can successfully render the “@2” bitmap into the screen, right?

Maybe wxPython does not compile this code?

Yeah, but its rendered scaled up for the 2.0 factor. I’m not sure how

wxPython would not compile the code since it seems to be in the wxwidgets

source included with it. I did originally download the binary though, so

perhaps something in the binary had it off.

I can’t find a single success story about retina and wxPython via google so

not sure whats up.

It is possible that wxPython release (code cut-off) was done prior to

this specific code

was put into wxWidgets.

Try building the wxWidgets Git HEAD along with wxPython Git HEAD and see if it

works.

Thank you.

Thank you.

Thank you.

On Mon, May 22, 2017 at 1:02 PM, Rishi Sharma rishsharma@gmail.com

wrote:

Hi!

I have a Macbook Pro Retina Touchbar. I made sure the screen is set

to

Default.

This is what I have found so far. I’m using wxPython 3.0.1.0

(although

I’ve tried to use the 4.0 version as well). Below is a sample

script I

wrote (requires AppKit PyObjC to check for backingScaleFactor). I

made

sure

to look at the backingScaleFactor and found it correctly it returns

I’m

looking at the bitmap code block and do see support:

    if  ( type == wxBITMAP_TYPE_PNG )
    {
        if ( wxOSXGetMainScreenContentScaleFactor() > 1.9 )
        {
            wxFileName fn(filename);
            fn.MakeAbsolute();
            fn.SetName(fn.GetName()+"@2x");
            if ( fn.Exists() )
            {
                fname = fn.GetFullPath();
                scale = 2.0;
            }
        }
    }

I just have no idea why its not working. Here is the sample:

import AppKit as AK

import wx

class MyFrame(wx.Frame):

def init(self, parent):

wx.Frame.__init__(self, parent, -1, "Retina Demo")
print AK.NSScreen.screens()[0].backingScaleFactor()
path = "img.png"
bmp = wx.EmptyBitmap( 1, 1 )
bmp.LoadFile(path, wx.BITMAP_TYPE_PNG)
bmp = wx.StaticBitmap(self, -1, bmp)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(bmp, 1, wx.ALL|wx.EXPAND, 5)
self.SetSizer(sizer)
sizer.Fit(self)
self.Layout()

app = wx.App()

frame = MyFrame(None)

app.SetTopWindow(frame)

frame.Show()

app.MainLoop()

On Mon, May 22, 2017 at 12:20 PM, Igor Korot ikorot01@gmail.com

wrote:

Hi,

On Mon, May 22, 2017 at 3:13 PM, Rishi Sharma

rishsharma@gmail.com

wrote:

Hi everyone,

I understand wxPython has support for retina text, but no matter

what I

do I

cannot get retina support working for images.

Does anyone have an idea on how to get it to work if possible? Do

I

need to

patch wxWidgets and rebuild wxPython? Whats the least version

that

supports

retina?

If anyone has a sample demo script that works I’d appreciate an

example.

What is your {wx}python versions?

What OSX version?

Are you sure you have a Retina display?

Thank you.

Thanks,

-R

You received this message because you are subscribed to the

Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it,

send

an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it,

send

an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it,

send

an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send

an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send

an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

For anyone who is having this problem, do not use the distributed version. Instead download the source and recompile. This fixed the problem for me.

···

On Mon, May 22, 2017 at 2:37 PM, Rishi Sharma rishsharma@gmail.com wrote:

I checked the source for that version: https://cytranet.dl.sourceforge.net/project/wxpython/wxPython/3.0.1.0/wxPython-src-3.0.1.0.tar.bz2 and the code block is in there.

Additionally I tried the same script with 4.0a and it doesn’t work either (which undoubtedly would have the changes).

I’m trying to build that version but keep getting errors in wxWidgets. I guess I’m missing the “ar” utility need to build it. So more googling.

On Mon, May 22, 2017 at 2:34 PM, Igor Korot ikorot01@gmail.com wrote:

Hi,

On Mon, May 22, 2017 at 5:08 PM, Rishi Sharma rishsharma@gmail.com wrote:

On Mon, May 22, 2017 at 1:56 PM, Igor Korot ikorot01@gmail.com wrote:

Hi,

On Mon, May 22, 2017 at 4:44 PM, Rishi Sharma rishsharma@gmail.com

wrote:

On Mon, May 22, 2017 at 1:11 PM, Igor Korot ikorot01@gmail.com wrote:

Hi,

On Mon, May 22, 2017 at 4:03 PM, Rishi Sharma rishsharma@gmail.com

wrote:

In order to test it uses the correct image, I have img.png and

img@2x.png

(both are actually different images so I can tell which one is

loaded).

Are they both accessible?

Just for the test - can you try to load both of them and check that

the bitmap IsOk()

returns true?

Done, both return True. Are you able to get the 2x image loaded with

the

script below (using substitute images)?

I don’t have Mac with Retina.

Now you can successfully render the “@2” bitmap into the screen, right?

Maybe wxPython does not compile this code?

Yeah, but its rendered scaled up for the 2.0 factor. I’m not sure how

wxPython would not compile the code since it seems to be in the wxwidgets

source included with it. I did originally download the binary though, so

perhaps something in the binary had it off.

I can’t find a single success story about retina and wxPython via google so

not sure whats up.

It is possible that wxPython release (code cut-off) was done prior to

this specific code

was put into wxWidgets.

Try building the wxWidgets Git HEAD along with wxPython Git HEAD and see if it

works.

Thank you.

Thank you.

Thank you.

On Mon, May 22, 2017 at 1:02 PM, Rishi Sharma rishsharma@gmail.com

wrote:

Hi!

I have a Macbook Pro Retina Touchbar. I made sure the screen is set

to

Default.

This is what I have found so far. I’m using wxPython 3.0.1.0

(although

I’ve tried to use the 4.0 version as well). Below is a sample

script I

wrote (requires AppKit PyObjC to check for backingScaleFactor). I

made

sure

to look at the backingScaleFactor and found it correctly it returns

I’m

looking at the bitmap code block and do see support:

    if  ( type == wxBITMAP_TYPE_PNG )
    {
        if ( wxOSXGetMainScreenContentScaleFactor() > 1.9 )
        {
            wxFileName fn(filename);
            fn.MakeAbsolute();
            fn.SetName(fn.GetName()+"@2x");
            if ( fn.Exists() )
            {
                fname = fn.GetFullPath();
                scale = 2.0;
            }
        }
    }

I just have no idea why its not working. Here is the sample:

import AppKit as AK

import wx

class MyFrame(wx.Frame):

def init(self, parent):

wx.Frame.__init__(self, parent, -1, "Retina Demo")
print AK.NSScreen.screens()[0].backingScaleFactor()
path = "img.png"
bmp = wx.EmptyBitmap( 1, 1 )
bmp.LoadFile(path, wx.BITMAP_TYPE_PNG)
bmp = wx.StaticBitmap(self, -1, bmp)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(bmp, 1, wx.ALL|wx.EXPAND, 5)
self.SetSizer(sizer)
sizer.Fit(self)
self.Layout()

app = wx.App()

frame = MyFrame(None)

app.SetTopWindow(frame)

frame.Show()

app.MainLoop()

On Mon, May 22, 2017 at 12:20 PM, Igor Korot ikorot01@gmail.com

wrote:

Hi,

On Mon, May 22, 2017 at 3:13 PM, Rishi Sharma

rishsharma@gmail.com

wrote:

Hi everyone,

I understand wxPython has support for retina text, but no matter

what I

do I

cannot get retina support working for images.

Does anyone have an idea on how to get it to work if possible? Do

I

need to

patch wxWidgets and rebuild wxPython? Whats the least version

that

supports

retina?

If anyone has a sample demo script that works I’d appreciate an

example.

What is your {wx}python versions?

What OSX version?

Are you sure you have a Retina display?

Thank you.

Thanks,

-R

You received this message because you are subscribed to the

Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it,

send

an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it,

send

an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it,

send

an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send

an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send

an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an

email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-users+unsubscribe@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Rish, just out of curiosity, when you recompiled, did you have to enable wxUSE_IMAGE yourself? It looks like the wxPython build script doesn’t use this option, and it also looks necessary for the @2x code in wxWidgets.

thanks!

Matt

···

On Thursday, August 10, 2017 at 1:59:16 PM UTC-7, Rish wrote:

For anyone who is having this problem, do not use the distributed version. Instead download the source and recompile. This fixed the problem for me.

On Mon, May 22, 2017 at 2:37 PM, Rishi Sharma rishs...@gmail.com wrote:

I checked the source for that version: https://cytranet.dl.sourceforge.net/project/wxpython/wxPython/3.0.1.0/wxPython-src-3.0.1.0.tar.bz2 and the code block is in there.

Additionally I tried the same script with 4.0a and it doesn’t work either (which undoubtedly would have the changes).

I’m trying to build that version but keep getting errors in wxWidgets. I guess I’m missing the “ar” utility need to build it. So more googling.

On Mon, May 22, 2017 at 2:34 PM, Igor Korot ikor...@gmail.com wrote:

Hi,

On Mon, May 22, 2017 at 5:08 PM, Rishi Sharma rishs...@gmail.com wrote:

On Mon, May 22, 2017 at 1:56 PM, Igor Korot ikor...@gmail.com wrote:

Hi,

On Mon, May 22, 2017 at 4:44 PM, Rishi Sharma rishs...@gmail.com > > > > > > >> wrote:

On Mon, May 22, 2017 at 1:11 PM, Igor Korot ikor...@gmail.com wrote:

Hi,

On Mon, May 22, 2017 at 4:03 PM, Rishi Sharma rishs...@gmail.com > > > > > > >> >> wrote:

In order to test it uses the correct image, I have img.png and

img@2x.png

(both are actually different images so I can tell which one is

loaded).

Are they both accessible?

Just for the test - can you try to load both of them and check that

the bitmap IsOk()

returns true?

Done, both return True. Are you able to get the 2x image loaded with

the

script below (using substitute images)?

I don’t have Mac with Retina.

Now you can successfully render the “@2” bitmap into the screen, right?

Maybe wxPython does not compile this code?

Yeah, but its rendered scaled up for the 2.0 factor. I’m not sure how

wxPython would not compile the code since it seems to be in the wxwidgets

source included with it. I did originally download the binary though, so

perhaps something in the binary had it off.

I can’t find a single success story about retina and wxPython via google so

not sure whats up.

It is possible that wxPython release (code cut-off) was done prior to

this specific code

was put into wxWidgets.

Try building the wxWidgets Git HEAD along with wxPython Git HEAD and see if it

works.

Thank you.

Thank you.

Thank you.

On Mon, May 22, 2017 at 1:02 PM, Rishi Sharma rishs...@gmail.com > > > > > > >> >> > wrote:

Hi!

I have a Macbook Pro Retina Touchbar. I made sure the screen is set

to

Default.

This is what I have found so far. I’m using wxPython 3.0.1.0

(although

I’ve tried to use the 4.0 version as well). Below is a sample

script I

wrote (requires AppKit PyObjC to check for backingScaleFactor). I

made

sure

to look at the backingScaleFactor and found it correctly it returns

I’m

looking at the bitmap code block and do see support:

    if  ( type == wxBITMAP_TYPE_PNG )
    {
        if ( wxOSXGetMainScreenContentScaleFactor() > 1.9 )
        {
            wxFileName fn(filename);
            fn.MakeAbsolute();
            fn.SetName(fn.GetName()+"@2x");
            if ( fn.Exists() )
            {
                fname = fn.GetFullPath();
                scale = 2.0;
            }
        }
    }

I just have no idea why its not working. Here is the sample:

import AppKit as AK

import wx

class MyFrame(wx.Frame):

def init(self, parent):

wx.Frame.__init__(self, parent, -1, "Retina Demo")
print AK.NSScreen.screens()[0].backingScaleFactor()
path = "img.png"
bmp = wx.EmptyBitmap( 1, 1 )
bmp.LoadFile(path, wx.BITMAP_TYPE_PNG)
bmp = wx.StaticBitmap(self, -1, bmp)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(bmp, 1, wx.ALL|wx.EXPAND, 5)
self.SetSizer(sizer)
sizer.Fit(self)
self.Layout()

app = wx.App()

frame = MyFrame(None)

app.SetTopWindow(frame)

frame.Show()

app.MainLoop()

On Mon, May 22, 2017 at 12:20 PM, Igor Korot ikor...@gmail.com > > > > > > >> >> >> wrote:

Hi,

On Mon, May 22, 2017 at 3:13 PM, Rishi Sharma > > > > > > >> >> >>> rishs...@gmail.com > > > > > > >> >> >>> wrote:

Hi everyone,

I understand wxPython has support for retina text, but no matter

what I

do I

cannot get retina support working for images.

Does anyone have an idea on how to get it to work if possible? Do

I

need to

patch wxWidgets and rebuild wxPython? Whats the least version

that

supports

retina?

If anyone has a sample demo script that works I’d appreciate an

example.

What is your {wx}python versions?

What OSX version?

Are you sure you have a Retina display?

Thank you.

Thanks,

-R

You received this message because you are subscribed to the

Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it,

send

an

email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it,

send

an

email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it,

send

an

email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send

an

email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google

Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send

an

email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an

email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups

“wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an

email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

You received this message because you are subscribed to the Google Groups “wxPython-users” group.

To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

wxUSE_IMAGE should be turned on by default.

···

On Saturday, May 19, 2018 at 2:05:29 PM UTC-7, itsayellow@gmail.com wrote:

Rish, just out of curiosity, when you recompiled, did you have to enable wxUSE_IMAGE yourself? It looks like the wxPython build script doesn’t use this option, and it also looks necessary for the @2x code in wxWidgets.

Robin

Do we still need to compile our own to get automatic scaling of @2x images? I’m failing to get retina-ready wx.Image working on wxPython 4.1 and 4.0.3 and not sure if I’m doing something wrong or the support just didn’t get included yet