Default size of BitmapButtons on 4.3.1

I don’t know if it was a deliberate change, or a side effect of a change elsewhere, but the default size of BitmapButtons is significantly smaller on 4.3.1 than it was on 4.2.5.

For example, on my linux PCs, a BitmapButton with a 16x16 image defaulted to 28x30 pixels on 4.2.5, but now default to only 18x19 pixels on 4.3.1.

Here is an example on 4.2.5

On 4.3.1, the default sizes look like this:

I much prefer the earlier style, so I am going through all my applications and explicitly setting the button sizes to what they used to be by default.

I believe the change is intentional (considered a bug fix) because the documentation for the Button base class states:

wx.BU_EXACTFIT: By default, all buttons are made of at least the standard button size, even if their contents is small enough to fit into a smaller size. This is done for consistency as most platforms use buttons of the same size in the native dialogs, but can be overridden by specifying this flag. If it is given, the button will be made just big enough for its contents. Notice that under MSW the button will still have at least the standard height, even with this style, if it has a non-empty label.

while the documentation for the derived BitmapButton amends the base class statement with:

Note that the wx.BU_EXACTFIT style supported by wx.Button is not used by this class as bitmap buttons don’t have any minimal standard size by default.

FWIW, I also preferred the previous defaults and am currently forcing sizes to: 34,34 which, at least on GTK, mimic the previous appearance.

Thanks for that information, Jorge.

One problem with hard coding the sizes of the bitmap buttons is that it is not very portable. Even on the same operating system, the desktop environment and the theme can make a difference.

My two desktop PCs both run Linux Mint 22.3. One PC uses MATE and the other uses Cinnamon.

When using wxPython 4.2.5, the default size of a BitmapButton containing a 16x16 bitmap was 28x30 on the PC using MATE, but was 38x34 on the PC using Cinnamon.

I suppose it depends on how much you want your applications to have the same appearance as other applications on the PC.

Hello Richard.

Does using FromDIP when hard coding the bitmap button size help you get a more uniform behavior for a given size across systems?

https://docs.wxpython.org/high_dpi_overview.html