Hello folks,
please help me with this two issues caused by wxPython upgrade from 4.0.7.post2 to 4.1.0:
Default size of buttons is different, buttons are smaller by default with new wxPython version. Why? Is possible to revert this behavior?
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.
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
Output with wxPython 4.1.0
As you can see, Custom Column #2 does not work and OK button is smaller.
Is it bug at my code
Is it bug at wxPython
Is it bug at wxWidgets
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:
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:
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.