Changes between 4.0.7 and 4.1.0

Hello folks,
please help me with this two issues caused by wxPython upgrade from 4.0.7.post2 to 4.1.0:

  1. Default size of buttons is different, buttons are smaller by default with new wxPython version. Why? Is possible to revert this behavior?

  2. My customized DataViewListCtrl widget stopped to show data at one column. The column uses custom renderer, but it does not work any more. Only workaround I found is to pass integer to DataViewListCtrl.SetValue() as string. But this was not necesery until version 4.1.0.
    So original call myListCtrl.SetValue(myInteger, 0, 0) has to be changed to myListCtrl.SetValue(str(myInteger), 0, 0). What is wrong? The custom column renderer expects integer.

Note: Python 3.7, Windows 7

Default size of buttons is different, buttons are smaller by default with new wxPython version. Why? Is possible to revert this behavior?

Despite the relatively small increment in version number, 4.0.7 -> 4.1.0 is actually a rather large change. 4.0.7 was based on wxWidgets 3.0, whereas 4.1.0 is based on the current development branch for 3.1.x. So, the change most likely was something that happened in wxWidgets development. Which buttons specifically?

My customized DataViewListCtrl widget stopped to show data at one column. The column uses custom renderer, but it does not work any more. Only workaround I found is to pass integer to DataViewListCtrl.SetValue() as string. But this was not necesery until version 4.1.0.
So original call myListCtrl.SetValue(myInteger, 0, 0) has to be changed to myListCtrl.SetValue(str(myInteger), 0, 0) . What is wrong? The custom column renderer expects integer.

It’s possible this could be a bug. The best way to find out is for you to produce a minimal, runnable example program that shows the problem.

Yeah, that’s true. It’s quite big step. As you advised, I wrote small runnable example program to show differences between versions 4.0.7 and 4.1.0 on Windows + Python 3.x platform.
See attached file: DVLC_test.py (10.0 KB)

Output with wxPython 4.0.7
dvlc_test_407

Output with wxPython 4.1.0
dvlc_test_410
As you can see, Custom Column #2 does not work and OK button is smaller.

Is it bug at my code :question:
Is it bug at wxPython :question:
Is it bug at wxWidgets :question:

How can I figure it out?

Thanks for the sample demo code. It was very helpful. On the Custom Column #2 problem, I found the issue. When using wxDataViewCustomRenderer, the default type is string, so if you want to use a different type, you have to change the varianttype in the constructor. Note that the variant types are as in wxWidgets, so in your case I believe you want to use long. See below which seems to resolve the issue.

class IdRenderer(dv.DataViewCustomRenderer):
    """ Renderer of DataViewListCtrl column with frame ID
        !!!!!!!!! EXPECTS value as INTEGER !!!!!!!!! """
    def __init__(self, *args, **kw):
        dv.DataViewCustomRenderer.__init__(self, varianttype='long', *args, **kw)
        self.value = None

On the issue of the button size, it seems like it is a Windows-specific difference as the button size is the same on GTK. Does the button size difference exist if you simplify your example even further and just put a button on a wx.Panel? If so, then you might want to ask on the wxWidgets mailing list about the button size difference. The wxPython bindings wouldn’t be doing anything with button sizes.

Great, thank you very much for your help!
It works fine now. I have completely overlooked the varianttype parameter. Honestly, it is not well documented.
Hmmm… what about custom renderer which can accept more data types? E.g. integer and float?

Default size of buttons is different also with even more simplified example:

Output of example:

wxPython 4.0.7.post2 msw (phoenix) wxWidgets 3.0.5 - wx.Button default size (width, height): (88, 26)
wxPython 4.1.0 msw (phoenix) wxWidgets 3.1.4 - wx.Button default size (width, height): (75, 23)

Button size is not big issue, but still… I am just curios about the cause.

It works fine now. I have completely overlooked the varianttype parameter.
Honestly, it is not well documented.
Hmmm… what about custom renderer which can accept more data types? E.g.
integer and float?

Well, ‘long’ is an integer so I’m not sure what you mean there. If you
wanted to use a floating point value, I think you could change varianttype
to ‘double’.

Default size of buttons is different also with even more simplified example:

  • button_size_test.py (755 Bytes)

Output of example:

wxPython 4.0.7.post2 msw (phoenix) wxWidgets 3.0.5 - wx.Button default size
(width, height): (88, 26)
wxPython 4.1.0 msw (phoenix) wxWidgets 3.1.4 - wx.Button default size (width
, height): (75, 23)

Button size is not big issue, but still… I am just curios about the cause.

You would have to ask the wxWidgets developers about that.

Scott

I think I remember a commit about the default button size, but I don’t remember the details. It might have been something like getting the default from the platform instead of using some calculated or fixed values in the wx code.