[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] stars.py using pygame (cvs) on python 2.3.1 on win98
Hi,
when I run the stars.py demo I get this message:
DeprecationWarning: integer argument expected, got float
and it runs slowly (K6-2 400Mhz). I traced it to :
file: stars.py
func: draw_stars
line: 46
surface.set_at(pos, color)
which, sure enough, is passing the position as a pair of floats.
The same thing affects surface.get_at() and is generated by this code in
'surface.c':
if (!PyArg_ParseTuple(args,"(ii)O",&x,&y,&rgba_obj)
return NULL;
My temporary bodge is to do this instead:
PyObject *xo,*yo;
if (!PyArg_ParseTuple(args,"(OO)O",&xo,&yo,&rgba_obj)
return NULL;
x = PyInt_AsLong(xo);
y = PyInt_AsLong(yo);
which doesn't have proper error checking.
Hope this helps a bit, but I would quite like to know what the best way of
handling this is. Explicitly checking the type and handling it accordingly
doesn't seem very Pythonic,
cheers,
John.