Facing an error in wx library file(rcsizer.py)

I work on python migration from 3.7 to 3.10 and I have already installed wxPython 4.2.1.but I got stuck in one place and facing an error in rcsizer.py file.
File “C:\Users\asdf\AppData\Local\Programs\Python\Python310\lib\site-packages\wx\lib\rcsizer.py”, line 153, in CalcMin
size = wx.Size( reduce( operator.add, self.colWidths),
TypeError: Size(): arguments did not match any overloaded call:
overload 1: too many arguments
overload 2: argument 1 has unexpected type ‘float’
overload 3: argument 1 has unexpected type ‘float’
Traceback (most recent call last):

rcsizer.py is readonly library file of wxpython. and I cann’t any changes there in rcsizer.py.

I noticed that rcsizer.py contains the following deprecation warning:

## #####################################################\
## # THIS MODULE IS NOW DEPRECATED                      |
## #                                                    |
## # The core wx library now contains a similar class   |
## # wrapped as wx.GridBagSizer.                        |
## #####################################################/

Perhaps you should consider migrating your application to using wx.GridBagSizer instead?

EDIT:

Prior to v3.10 python used to silently convert floats to ints when they were passed to a function or method in a C++ extension (such as the Size() method) that requires integer argument(s).

In python v3.10 and later that no longer happens so the calling code must be modified to explicitly pass integers.

An issue was raised for this on GitHub, but it has not been addressed - probably due to the module being deprecated.

2 Likes

Thank You RichardT for your great support