[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] Fixed -- I'm having problems with the pygame C api



On Wed, 17 Oct 2001, Pete Shinners wrote:

> Ben Smith wrote:
> 
> the best place to call the "import_pygame_surface" function is
> inside your "initmodule()" function that gets called when python
> initializes your module. be sure to call it _after_ the module
> has initialized itself. if you look at any of the pygame modules,
> you can easily see how these import macros are used.
> 
> the different pygame modules don't get any "special benefits"
> that a module you write doesn't get. so the stuff that pygame.draw
> does to get surface objects and work with them is no different than
> what you can do in your own extensions.
> 
> since the PySurface_Check() is failing, i'm pretty sure the problem is 
> that you haven't yet "import_pygame_surface()"d. your "PySurface_Type" 
> is likely pointing to NULL.
> 


>  
> > Thank you. I still have the question of why PySurface_Check is failing 
> > when both modules are imported from a python script. 
> 
> 
> just remember, it's not important that your python code imports both 
> modules. your extension module must call the pygame_import_surface() 
> macro for it's C calls to pygame to work.
> 
> 

Sure enough, the bug here is assuming that "import pygame" in the python 
script was the same as what import_pygame_surface() would do for me.  I 
just tried it out, thanks!

<shameless plug>
Found another bug, but look for a new release of pymousetrap tonight, with
an example!
<http://pymousetrap.sf.net>
</shameless plug>

-b

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org