[Tutor] pygame help

John Harvey johnharvey@earthlink.net
Sat, 28 Sep 2002 08:48:14 -0700


At 11:40 AM 9/28/2002 +0000, Kyle Babich wrote:
>Today I downloaded the pygame exe for python 2.2 on win32 into my c:\
>and installed it into c:\python22.  I was able to "import pygame" but
>anything else like "import pygame.CD" tells me the module doesn't
>exist.  What did I do wrong?

I'm in the process of learning how one answers this kind of question with a 
new Python package. Maybe one of the old timers here could point us to a 
tutorial regarding the use of the help system.

After seeing your question I downloaded pygame and tried to find the answer 
to your question. If my understanding is correct, you can find the names of 
the modules in pygame as follows:

 >>>help(pygame)
     --OR--
 >>>help()
help>pygame

Either of these yield the following:

-----8<----------snip---------->8-----
PACKAGE CONTENTS
     SDL
     SDL_image
     SDL_mixer
     SDL_ttf
     __init__
     base
     cdrom
     constants
     cursors
     display
     draw
-----8<----------snip---------->8-----

Which means that there isn't a module named CD.

help> pygame.cdrom yields:

-----8<----------snip---------->8-----
FUNCTIONS
     CD(...)
         pygame.cdrom.CD(id) -> CD
         create new CD object

         Creates a new CD object for the given CDROM id. The given id
         must be less than the value from pygame.cdrom.get_count().
-----8<----------snip---------->8-----

Therefore, CD is a function (not a module) of the cdrom module of the 
pygame package.