Working with py3.10 and wxPy 4.1.2a

I believe in the past dc.DrawText() would accept a float for x and y. On Windows 10 I get an error:
arument 2 has unexpected type ‘float’
I did not see any changes in the doc’s. I believe older versions of wxPython accepted a float???
Am I wrong.

This is a Python 3.10 change not a wxPython one. Floats are no longer
allowed to be passed to C extensions (ie, wxPython) where there would be
silent truncation. So, you have to explicitly pass ints now.

Scott

Any chance you are aware of how the float was converted - meaning 6.9999 is 7. Can just use int() to convert the float to an int or is there some other requirements/rules.

Johnf

Previously floats were being silently truncated, ie 6.9999 would become 6.
If you want to retain the same behavior, you could use int(). If you want
a different behavior, such as rounding, you could do that instead.

Scott

I will try using int() first and see if that works. Appears you understood my question completely.
Thanks
Johnf

Yep. Using int() will make things work like they did in Python 3.9 and
older. I guess the Python core developers just wanted to make you aware
that you were losing information. :slight_smile:

Unfortunately, this seems to be one of the biggest fallouts from Python
3.10…lots of code needing to be updated.

Scott