Sizers not working correctly on OSX Mojave

Hi,

I was playing around with the attached code and noticed that it doesn’t work correctly on Mac OSX Mojave. The button should be stretched out in both directions and take up most of the frame’s space. Instead, it just stretches in one direction. On Windows and Linux, this code works as expected. I am using wxPython 4.0.3 with Python 3.6 on all 3 platforms.

I noticed the sizer also does some screwy things on my Mac if I add another widget to it too. The widgets are not next to each other as I would expect. It is as if the border is getting stretched or expanded rather then the widget itself.

Thanks,

Mike

simple_sizer_expand.py (658 Bytes)

sizer_with_proportion.png

Yep. This is normal for the native button widget on macOS. The wxButton is actually the expected size, as can be seen in the widget inspector tool, but the native widget will only draw itself at the standard heights and won’t draw anything in the remaining space. If you need a taller than standard button, then you can add a bitmap, use a generic button from wx.lib.buttons, or etc.

···

On Tuesday, November 13, 2018 at 9:44:30 AM UTC-8, Mike Driscoll wrote:

Hi,

I was playing around with the attached code and noticed that it doesn’t work correctly on Mac OSX Mojave. The button should be stretched out in both directions and take up most of the frame’s space. Instead, it just stretches in one direction. On Windows and Linux, this code works as expected. I am using wxPython 4.0.3 with Python 3.6 on all 3 platforms.

I noticed the sizer also does some screwy things on my Mac if I add another widget to it too. The widgets are not next to each other as I would expect. It is as if the border is getting stretched or expanded rather then the widget itself.

Robin

Hi Robin,

Hi,

I was playing around with the attached code and noticed that it doesn’t work correctly on Mac OSX Mojave. The button should be stretched out in both directions and take up most of the frame’s space. Instead, it just stretches in one direction. On Windows and Linux, this code works as expected. I am using wxPython 4.0.3 with Python 3.6 on all 3 platforms.

I noticed the sizer also does some screwy things on my Mac if I add another widget to it too. The widgets are not next to each other as I would expect. It is as if the border is getting stretched or expanded rather then the widget itself.

Yep. This is normal for the native button widget on macOS. The wxButton is actually the expected size, as can be seen in the widget inspector tool, but the native widget will only draw itself at the standard heights and won’t draw anything in the remaining space. If you need a taller than standard button, then you can add a bitmap, use a generic button from wx.lib.buttons, or etc.

Robin

That’s really interesting. I haven’t played around with my sizer examples in Mac OSX enough then.

Thanks for letting me know.

Mike

···

On Tue, Nov 13, 2018 at 1:42 PM Robin Dunn robin@alldunn.com wrote:

On Tuesday, November 13, 2018 at 9:44:30 AM UTC-8, Mike Driscoll wrote: