[Python-talk] mat3d error

Python python at venix.com
Thu Sep 11 12:53:00 EDT 2008


I'm going to assume an error in your code.  I just don't have these
packages in place to test from here.

On Thu, 2008-09-11 at 11:49 -0400, Labitt, Bruce wrote:
> As described earlier, I have this error message when I try to save the
> graphics that the mat3d_ex4.py file generates.
> 
> Exception in Tkinter callback
> Traceback (most recent call last):
>   File "/usr/lib64/python2.4/lib-tk/Tkinter.py", line 1345, in
> __call__
>     return self.func(*args)
>   File "/home/me/mypython/mat3d/mat3d.py", line 637, in save
>     self.SaveTo(fileName)
>   File "/home/me/mypython/mat3d/mat3d.py", line 645, in SaveTo
>     data = glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE)

So you are supplying two integers, two variables (also ints?), and two
constants that probably came from the modules and we'll assume are
correct.

>   File "/usr/lib/python2.4/site-packages/PyOpenGL-3.0.0b5-py2.4.egg/OpenGL/GL/images.py", line 323, in glReadPixels
>     ctypes.c_void_p( imageData )
> ArgumentError: argument 3: exceptions.TypeError: wrong type

I presume the glReadPixels function is using your arguments to build
imageData and pass that to the ctypes module in preparation for calling
the C libraries.  If you can read that function and decipher how your
arguments were processed, that might explain the error.  If the argument
order was preserved, width could be the culprit.

What are the width and height values that you are passing in?
If the fix is not obvious, please paste some code from glReadPixels to
show how imageData gets built.


-- 
Lloyd Kvam
Venix Corp
DLSLUG/GNHLUG library
http://dlslug.org/library.html
http://www.librarything.com/catalog/dlslug
http://www.librarything.com/rsshtml/recent/dlslug
http://www.librarything.com/rss/recent/dlslug



More information about the Python-talk mailing list