[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygameC and pygame-ctypes



Tim Ansell wrote:

Hello,

In my new library I would like to support both pygameC and
pygame-ctypes.


There should be no need for this functionality. Pygame-ctypes is not generally released, and the instructions on the website strongly urge users _not_ to install it. If you would prefer to use Pygame-ctypes over Pygame, you can do this by including Pygame-ctypes directly with your distribution (or in .egg form) and setting sys.path appropriately.

The actual code for supporting both is pretty easy. However, I need the
correct way to detect which version of pygame is installed.


You should assume Pygame(C) is installed, unless you are bundling Pygame-ctypes.

I would also like to know if there is a way to install both versions of
pygame at once so I can easily test both versions? How would I then say
which version to use?


They cannot generally be installed side-by-side, though by changing sys.path you could effectively achieve this. If you _really_ need to test which one is imported (again, I don't recommend this), check for a feature only Pygame-ctypes has; for example::

   import pygame.surfarray
   if hasattr(pygame.surfarray, 'set_array_module'):
        # Must be Pygame-ctypes

wxPython has a wxversions module which lets you select different types
of wxPython. (IE Unicode, 2.6, 2.7, etc) Maybe something like this for
pygame could be useful?


The result of the pygame-users discussion a few months ago was that Pygame-ctypes development would effectively be stopped, as there was little support for it developing in place of Pygame(C). If there is future development, it will likely be under a different module name.

Cheers
Alex.