I just upgraded to python 2.3 and the latest wxPython on Windows. I am now
getting a
number of warnings that I didn't get before using 2.4.0.7. Does this mean
that I have to
change all the floats to integer for positions and lengths? Why the change?
The Python development team has decided (and I think with good reason)
that if you are calling PyArg_ParseTuple() and specifying that you are
expecting an integer, then you really ought to be passing an integer
through from your Python code.
So there are two options, and I'm not sure which one makes the most
sense.
1) modify the wxPython C extension to specify that it allows floating
point, not integer
OR
2) modify your code so that you don't pass floats to routines expecting
integers
I suspect the latter is what is needed but I'll let someone with better
knowledge answer that question.
···
On Fri, 2003-07-25 at 13:37, Gordon Williams wrote:
Hi,
I just upgraded to python 2.3 and the latest wxPython on Windows. I am now
getting a
number of warnings that I didn't get before using 2.4.0.7. Does this mean
that I have to
change all the floats to integer for positions and lengths? Why the change?
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwindows.org
For additional commands, e-mail: wxPython-users-help@lists.wxwindows.org
--
Anthony Tuininga
anthony@computronix.com
Computronix
Distinctive Software. Real People.
Suite 200, 10216 - 124 Street NW
Edmonton, AB, Canada T5N 4A3
Phone: (780) 454-3700
Fax: (780) 454-3838
The Python development team has decided (and I think with good reason)
that if you are calling PyArg_ParseTuple() and specifying that you are
expecting an integer, then you really ought to be passing an integer
through from your Python code.
So there are two options, and I'm not sure which one makes the most
sense.
1) modify the wxPython C extension to specify that it allows floating
point, not integer
To do that would mean that even if you do pass integers that PyArg_ParseTuple would convert it to a float and then it would then get truncated back to an integer to be passed to the API.
2) modify your code so that you don't pass floats to routines expecting
integers
I suspect the latter is what is needed but I'll let someone with better
knowledge answer that question.
Yep.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
Anthony Tuininga wrote:
> The Python development team has decided (and I think with good reason)
> that if you are calling PyArg_ParseTuple() and specifying that you are
> expecting an integer, then you really ought to be passing an integer
> through from your Python code.
>
> So there are two options, and I'm not sure which one makes the most
> sense.
>
> 1) modify the wxPython C extension to specify that it allows floating
> point, not integer
To do that would mean that even if you do pass integers that
PyArg_ParseTuple would convert it to a float and then it would then get
truncated back to an integer to be passed to the API.
> 2) modify your code so that you don't pass floats to routines expecting
> integers
>
> I suspect the latter is what is needed but I'll let someone with better
> knowledge answer that question.
Yep.
For all of you updating your code, just remember that round() returns a
float, so if you want to round your var use int(round(yourVar)) and if you
just want to truncate use int(yourVar). Seems obvious enough, but it is an
easy place to make a mistake.
If you want the same results as you got prior to Python 2.3 you probably
just want int(yourVar) for truncation if I understand what wxPython has been
doing with the argument lists.