Пример #1
0
def load_image(name):  #Used to load the cursor and Toad image files
    fullname = os.path.join(main_dir, name)
    try:
        image = pygame.image.load(fullname)
    except pygame.error:
        print('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    return image, image.get_rect()
Пример #2
0
def load_image(name):
    try:
        image = pygame.image.load(name)
    except pygame.error:
        print('Cannot load image: ', name)
        raise SystemExit(str(geterror()))
    image = image.convert()
    return image, image.get_rect()
Пример #3
0
def load_image(name, colorkey=None):
    fullname = os.path.join(data_dir, name)
    try:
        image = pygame.image.load(fullname)
    except pygame.error:
        print ('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    return image
Пример #4
0
def load_image(name, colorkey=None):
    fullname = os.path.join(data_dir, name)
    try:
        image = pygame.image.load(fullname)
    except pygame.error:
        print('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    return image
Пример #5
0
 def test_geterror(self):
     msg = 'Success'
     try:
         raise TypeError(msg)
     except TypeError:
         e = compat.geterror()
         self.failUnless(isinstance(e, TypeError))
         self.failUnlessEqual(str(e), msg)
Пример #6
0
 def test_geterror(self):
     msg = 'Success'
     try:
         raise TypeError(msg)
     except TypeError:
         e = compat.geterror()
         self.failUnless(isinstance(e, TypeError))
         self.failUnlessEqual(str(e), msg)
Пример #7
0
 def test_geterror(self):
     msg = 'Success'
     try:
         raise TypeError(msg)
     except TypeError:
         e = compat.geterror()
         self.assertTrue(isinstance(e, TypeError))
         self.assertEqual(str(e), msg)
def load_image(name): #Used to load the cursor and Toad image files
    fullname = os.path.join(main_dir, name)
    try:
        image = pygame.image.load(fullname)
    except pygame.error:
        print ('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    return image, image.get_rect()
Пример #9
0
 def test_geterror(self):
     msg = "Success"
     try:
         raise TypeError(msg)
     except TypeError:
         e = compat.geterror()
         self.assertIsInstance(e, TypeError)
         self.assertEqual(str(e), msg)
Пример #10
0
def load_file(name):
    fullname = os.path.join(data_dir, name)
    try:
        text = open(name, 'r')
    except pygame.error:
        print('Cannot load file:', fullname)
        raise SystemExit(str(geterror()))

    return text
Пример #11
0
 def load_font(cls,name):
     fullname = Asset.resource_path(os.path.join(Asset.data_dir, name))
     font = None
     try:
         font = pygame.font.Font(fontfile, 26)
     except pygame.error:
         print ('Cannot load font:', fullname)
         raise SystemExit(str(geterror()))
     return font
Пример #12
0
def _load_image(name):
    fullname = os.path.join(assets_dir, name)
    try:
        image = pygame.image.load(fullname)
    except pygame.error:
        print('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    image = image.convert_alpha()
    return image
Пример #13
0
def load_image(fileName, size=None):
    fullname = os.path.join(data_dir, fileName)
    try:
        image = pygame.image.load(fullname)
    except pygame.error:
        print('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    if size:
        image = pygame.transform.scale(image, (size[0], size[1]))
    return image
Пример #14
0
def load_image(name, scale=(30,200)):
    fullname = os.path.join(data_dir, name)
    try:
        image = pygame.image.load(fullname)
    except pygame.error:
        print ('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    image = image.convert()
    image = pygame.transform.scale(image, scale)
    return image, image.get_rect()
Пример #15
0
def load_sound(name):  #Used to load the Toad's noises
    if not pygame.mixer or not pygame.mixer.get_init():
        return NoneSound()
    fullname = os.path.join(main_dir, name)
    try:
        sound = pygame.mixer.Sound(fullname)
    except pygame.error:
        print('Cannot load sound: %s' % fullname)
        raise SystemExit(str(geterror()))
    return sound
Пример #16
0
 def __call__(self, *args, **kwargs):
     #we try to call the function here.  If it fails we store the exception.
     try:
         self.result = self.f(*args, **kwargs)
         if self.callback:
             self.callback(self.result)
     except Exception:
         self.exception = geterror()
         if self.errback:
             self.errback(self.exception)
def load_sound(name): #Used to load the Toad's noises
    if not pygame.mixer or not pygame.mixer.get_init():
        return NoneSound()
    fullname = os.path.join(main_dir, name)
    try:
        sound = pygame.mixer.Sound(fullname)
    except pygame.error:
        print ('Cannot load sound: %s' % fullname)
        raise SystemExit(str(geterror()))
    return sound
Пример #18
0
def load_sound(name):
    class NoneSound:
        def play(self): pass
    if not pygame.mixer:
        return NoneSound()
    try:
        sound = pygame.mixer.Sound(name)
    except pygame.error:
        print ('Cannot load sound %s' % name)
        raise SystemExit(str(geterror()))
    return sound
Пример #19
0
def load_image(filename, convert_alpha=False):
    filepath = os.path.join(data_dir, filename)
    try:
        image = pygame.image.load(filepath)
    except pygame.error:
        raise SystemExit(geterror())
    if convert_alpha:
        image = image.convert_alpha()
    else:
        image = image.convert()
    return image, image.get_rect()
Пример #20
0
    def __call__(self, *args, **kwargs):

        #we try to call the function here.  If it fails we store the exception.
        try:
            self.result = self.f(*args, **kwargs)
            if self.callback:
                self.callback(self.result)
        except Exception:
            self.exception = geterror()
            if self.errback:
                self.errback(self.exception)
Пример #21
0
def load_song(c, name):
    fullname = os.path.join(c.MUSC_DIR, name)
    try:
        pygame.mixer.music.load(fullname)
        pygame.mixer.music.set_volume(c.VOLUME[0])
    except pygame.error:
        message = 'COULD NOT LOAD MUSIC: ' + fullname
        debug(c.DEBUG, message)
        errorbox("Failed Loading Song", message)
        raise SystemExit(str(geterror()))
    return
Пример #22
0
def load_sound(name):
    class NoneSound:
        def play(self): pass
    if not pygame.mixer or not pygame.mixer.get_init():
        return NoneSound()
    fullname = os.path.join(data_dir, name)
    try:
        sound = pygame.mixer.Sound(fullname)
    except pygame.error:
        print ('Cannot load sound: %s' % fullname)
        raise SystemExit(str(geterror()))
    return sound
Пример #23
0
def load_skill_image(name, ClassName, SkillName):
    fullnamewithFoldername = os.path.join(data_dir, ClassName, SkillName)
    fullname = os.path.join(fullnamewithFoldername, name)

    try:
        image = pygame.image.load(fullname)
    except pygame.error:
        print('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    #image = image.convert()

    return image, image.get_rect()
Пример #24
0
def load_image(name, colorkey=None):
    try:
        image = pygame.image.load(name)
    except pygame.error:
        print('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    image = image.convert()
    if colorkey is not None:
        if colorkey == -1:
            colorkey = image.get_at((0, 0))
        image.set_colorkey(colorkey, RLEACCEL)
    return image, image.get_rect()
Пример #25
0
def load_sound(name):
    class NoneSound:
        def play(self): pass
    if not pygame.mixer or not pygame.mixer.get_init():
        return NoneSound()
    fullname = os.path.join(data_dir, name)
    try:
        sound = pygame.mixer.Sound(fullname)
    except pygame.error:
        print ('Cannot load sound: %s' % fullname)
        raise SystemExit(str(geterror()))
    return sound
Пример #26
0
def _sound(name):
    class NoneSound(object):
        def play(self):
            pass
    if not pygame.mixer or not pygame.mixer.get_init():
        return NoneSound()
    fullname = os.path.join(data_dir, name)
    try:
        return pygame.mixer.Sound(fullname)
    except pygame.error:
        print >> sys.stderr, 'Cannot load sound: %s' % fullname
        sys.exit(geterror())
Пример #27
0
 def load_one_alpha_image(cls, name, colorkey=None):
     fullname = Asset.resource_path(os.path.join(Asset.data_dir, name))
     try:
         image = pygame.image.load(fullname)
     except pygame.error:
         print ('Cannot load image:', fullname)
         raise SystemExit(str(geterror()))
     image = image.convert_alpha()
     if colorkey is not None:
         if colorkey is -1:
             colorkey = image.get_at((0,0))
         image.set_colorkey(colorkey, RLEACCEL)
     return image, image.get_rect()
Пример #28
0
def loadImageOnly(name):
    try:
        image = pygame.image.load(name)
    except pygame.error:
        print("Failed to load images: ", fullname)
        raise SystemExit(str(geterror()))

    if image.get_alpha is None:
        image = image.convert()
    else:
        image = image.convert_alpha()

    return image
Пример #29
0
def load_image(name, colorkey=None):
    fullname = os.path.join(img_dir, name)
    try:
        image = pygame.image.load(fullname).convert()
    except pygame.error:
        print ('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    image = image.convert()
    if colorkey is not None:
        if colorkey is -1:
            colorkey = image.get_at((0,0))
        image.set_colorkey(colorkey, RLEACCEL)
    return image
Пример #30
0
def load_sprite_image(name, f1, f2, f3, f4):
    fullnamewithFoldername = os.path.join(data_dir, f1, f2, f3, f4)
    fullname = os.path.join(fullnamewithFoldername, name)

    try:
        image = pygame.image.load(fullname)
        #image.set_colorkey((0,0,0))
    except pygame.error:
        print('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    #image = image.convert()

    return image, image.get_rect()
Пример #31
0
 def load_image(name):
     main_dir = os.path.split(os.path.abspath(__file__))[0]
     data_dir = os.path.join(main_dir, 'data')
     fullname = os.path.join(data_dir, name)
     if fullname in SimpleSprite.loaded_images:
         return SimpleSprite.loaded_images[fullname]
     try:
         image = pygame.image.load(fullname)
         SimpleSprite.loaded_images[fullname] = image
     except pygame.error:
         print ('Cannot load image:', fullname)
         raise SystemExit(str(geterror()))
     return image
Пример #32
0
def load_image(name):
    fullpath = os.path.join(graphics_dir, name)
    try:
        image = pygame.image.load(fullpath)
    except pygame.error:
        print('cannot load image', fullpath)
        raise SystemExit(str(geterror()))

    # upscale loaded images by 2x and 2y
    dimensions = (2 * image.get_width(), 2 * image.get_height())
    image = pygame.transform.scale(image, dimensions)

    return image
Пример #33
0
def load_mem_image(buf, colorkey=None):
    try:
        buf.seek(0)
        image = pygame.image.load(buf)
    except pygame.error:
        print('Cannot load mem image!:', buf)
        raise SystemExit(str(geterror()))
    image = image.convert()
    if colorkey is not None:
        if colorkey is -1:
            colorkey = image.get_at((0, 0))
        image.set_colorkey(colorkey, RLEACCEL)
    return image, image.get_rect()
Пример #34
0
def loadImage(name, colorkey=None):
    try:
        image = pygame.image.load(name)
    except pygame.error:
        print("EFailed to load image: ", fullname)
        raise SystemExit(str(geterror()))

    if image.get_alpha is None:
        image = image.convert()
    else:
        image = image.convert_alpha()

    return image, image.get_rect()
Пример #35
0
def load_image(name, colorkey=None):
    fullname = os.path.join(data_dir, name)
    try:
        image = pg.image.load(fullname)
    except pg.error:
        print(("Cannot load image:", fullname))
        raise SystemExit(str(geterror()))
    image = image.convert()
    if colorkey is not None:
        if colorkey == -1:
            colorkey = image.get_at((0, 0))
        image.set_colorkey(colorkey, pg.RLEACCEL)
    return image, image.get_rect()
Пример #36
0
def _image(name, colorkey=None):
    fullname = os.path.join(data_dir, name)
    try:
        image = pygame.image.load(fullname)
    except pygame.error:
        print >> sys.stderr, 'Cannot load image:', fullname
        sys.exit(geterror())
    image = image.convert()
    if colorkey is not None:
        if colorkey is -1:
            colorkey = image.get_at((0, 0))
        image.set_colorkey(colorkey, RLEACCEL)
    return image
Пример #37
0
def load_image(name, colorkey=None):
    fullname = os.path.join(img_dir, name)
    try:
        image = pygame.image.load(fullname)
    except pygame.error:
        print ('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    #image = image.convert()
    if colorkey is not None:
        if colorkey is -1:
            colorkey = image.get_at((0,0))
        image.set_colorkey(colorkey, RLEACCEL)
    return image
Пример #38
0
def load_sound(name):
    class NoneSound:
        def play(self):
            pass

    if not pg.mixer or not pg.mixer.get_init():
        return NoneSound()
    fullname = os.path.join('./audio', name)
    try:
        sound = pg.mixer.Sound(fullname)
    except pg.error:
        print("Cannot load sound: ", fullname)
        raise SystemExit(str(geterror()))
    return sound
Пример #39
0
    def load_image(cls, name, rects, colorkey=None):
        if type(name) is not str:
            raise TypeError

        fullname = Asset.resource_path(os.path.join(Asset.data_dir, name))
        ss = spritesheet.spritesheet(fullname)
        images = None
        try:
            images = ss.images_at(rects, colorkey=colorkey)
        except pygame.error:
            print ('Cannot load image:', fullname)
            raise SystemExit(str(geterror()))

        return images
Пример #40
0
def load_image(name, colorkey=None):
    fullname = os.path.join(data_dir, name)
    try:
        image = PyGL3Display.PyGL3Display_2dSprites.GL3PygameSurface.GL3Load(fullname)
    except pygame.error:
        print ('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    
    image = image.convert()
    if colorkey is not None:
        if colorkey is -1:
            colorkey = image.get_at((0,0))
        image.set_colorkey(colorkey, RLEACCEL)
    return image, image.get_rect()
Пример #41
0
def image(name, colorkey = None):
    #image stuff here
    fullname = os.path.join(data_dir, name)
    try:
        image = pygame.image.load(fullname)
    except pygame.error:
        print ("cannot load image:", fullname)
        raise SystemExit(str(geterror()))
    image = image.convert()
    if colorkey is not None:
        if colorkey is -1:
            colorkey = image.get_at((0,0))
        image.set_colorkey(colorkey, RLEACCEL)
    return image, image.get_rect()
Пример #42
0
def load_image(name, colorkey=None):
    fullname = os.path.join(images_dir, name)
    try:
        image = pg.image.load(fullname)
        print("STATUS: Image loaded.")
    except pg.error:
        print("ERROR: Cannot load image:", fullname)
        raise SystemExit(str(geterror()))
    image = image.convert()
    if colorkey is not None:
        if colorkey == -1:
            colorkey = image.get_at((0, 0))
        image.set_colorkey(colorkey, pg.RLEACCEL)
    return image
Пример #43
0
def load_image(name, colorkey=None):
    filename = os.path.join(data_dir, name)
    try:
        image = pygame.image.load(filename)
    except pygame.error:
        raise SystemExit(str(geterror()))
    image = image.convert()

    if colorkey is not None:
        if colorkey is -1:
            # sets color key to color found at 0,0  in the image. that's actually pretty clever.
            colorkey = image.get_at((0, 0))
        image.set_colorkey(colorkey, pygame.RLEACCEL)
    return image, image.get_rect()
Пример #44
0
def load_image(name, colorkey=None):
    filename = os.path.join(data_dir, name)
    try:
        image = pygame.image.load(filename)
    except pygame.error:
        raise SystemExit(str(geterror()))
    image = image.convert()

    if colorkey is not None:
        if colorkey is -1:
            # sets color key to color found at 0,0  in the image. that's actually pretty clever.
            colorkey = image.get_at((0, 0))
        image.set_colorkey(colorkey, pygame.RLEACCEL)
    return image, image.get_rect()
Пример #45
0
def load_image(name, colorkey=None):
    fullname = os.path.join(data_dir, name)
    try:
        my_image = pg.image.load(fullname)
        # image = pg.transform.smoothscale(image, (SIZE - 1, SIZE - 1))
    except pg.error:
        print("Cannot load image:", fullname)
        raise SystemExit(str(geterror()))
    my_image = my_image.convert()
    if colorkey is not None:
        if colorkey == -1:
            colorkey = my_image.get_at((0, 0))
        my_image.set_colorkey(colorkey, pg.RLEACCEL)
    return my_image
Пример #46
0
def load_image(name, colorkey=None):
    fullname = unicode(os.path.join(data_dir, name).decode(system_encoding))
    try:
        f = open(fullname, 'rb')
        content = f.read()
        f.seek(0)
        image = pygame.image.load(f, fullname.encode('utf-8'))
    except pygame.error:
        print ('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    image = image.convert()
    if colorkey is not None:
        if colorkey is -1:
            colorkey = image.get_at((0,0))
        image.set_colorkey(colorkey, RLEACCEL)
    return image, image.get_rect()
Пример #47
0
def load_image(name, name2=None):
    fullname = os.path.join(data_dir, name)
    try:
        image = pygame.image.load(fullname)
        if name2:
            image1 = image.convert_alpha()
            image2 = pygame.image.load(os.path.join(data_dir, name2))
            image2 = image2.convert_alpha()
            w = max(image2.get_width(), image1.get_width())
            h = max(image2.get_height(), image1.get_height())
            image = pygame.Surface((w,h), pygame.SRCALPHA, 32)
            image = image.convert_alpha()
            image.blit(image2, (1,1))
            image.blit(image1, (round(w/2 - image1.get_width()/2), 1))
    except pygame.error:
        print ('Cannot load image:', fullname)
        raise SystemExit(str(geterror()))
    image = image.convert_alpha()
    return image, image.get_rect()
Пример #48
0
    def test_post(self):
    
        # __doc__ (as of 2008-08-02) for pygame.fastevent.post:
    
          # pygame.fastevent.post(Event) -> None
          # place an event on the queue
          # 
          # This will post your own event objects onto the event queue.
          # You can past any event type you want, but some care must be
          # taken. For example, if you post a MOUSEBUTTONDOWN event to the
          # queue, it is likely any code receiving the event will expect
          # the standard MOUSEBUTTONDOWN attributes to be available, like
          # 'pos' and 'button'.
          # 
          # Because pygame.fastevent.post() may have to wait for the queue
          # to empty, you can get into a dead lock if you try to append an
          # event on to a full queue from the thread that processes events.
          # For that reason I do not recommend using this function in the
          # main thread of an SDL program.
    
        for _ in range(1, 11):
            fastevent.post(event.Event(pygame.USEREVENT))
        
        self.assertEquals (
            [e.type for e in event.get()], [pygame.USEREVENT] * 10,
            race_condition_notification
        )

        try:
            # Special case for post: METH_O.
            fastevent.post(1)
        except TypeError:
            e = geterror()
            msg = ("argument 1 must be %s, not %s" %
                   (fastevent.Event.__name__, type(1).__name__))
            self.failUnlessEqual(str(e), msg)
        else:
            self.fail()
Пример #49
0
 def test_sound_args(self):
     def get_bytes(snd):
         return snd.get_buffer().raw
     
     mixer.init()
     try:
         sample = as_bytes('\x00\xff') * 24
         wave_path = example_path(os.path.join('data', 'house_lo.wav'))
         uwave_path = unicode_(wave_path)
         bwave_path = uwave_path.encode(sys.getfilesystemencoding())
         snd = mixer.Sound(file=wave_path)
         self.assert_(snd.get_length() > 0.5)
         snd_bytes = get_bytes(snd)
         self.assert_(len(snd_bytes) > 1000)
         self.assert_(get_bytes(mixer.Sound(wave_path)) == snd_bytes)
         self.assert_(get_bytes(mixer.Sound(file=uwave_path)) == snd_bytes)
         self.assert_(get_bytes(mixer.Sound(uwave_path)) == snd_bytes)
         arg_emsg = 'Sound takes either 1 positional or 1 keyword argument'
         try:
             mixer.Sound()
         except TypeError:
             self.assertEqual(str(geterror()), arg_emsg)
         else:
             self.fail("no exception")
         try:
             mixer.Sound(wave_path, buffer=sample)
         except TypeError:
             self.assertEqual(str(geterror()), arg_emsg)
         else:
             self.fail("no exception")
         try:
             mixer.Sound(sample, file=wave_path)
         except TypeError:
             self.assertEqual(str(geterror()), arg_emsg)
         else:
             self.fail("no exception")           
         try:
             mixer.Sound(buffer=sample, file=wave_path)
         except TypeError:
             self.assertEqual(str(geterror()), arg_emsg)
         else:
             self.fail("no exception")           
         try:
             mixer.Sound(foobar=sample)
         except TypeError:
             emsg = "Unrecognized keyword argument 'foobar'"
             self.assertEqual(str(geterror()), emsg)
         else:
             self.fail("no exception")
         snd = mixer.Sound(wave_path, **{})
         self.assertEqual(get_bytes(snd), snd_bytes)
         snd = mixer.Sound(*[], **{'file': wave_path})          
         try:
            snd = mixer.Sound([])
         except TypeError:
             emsg = 'Unrecognized argument (type list)'
             self.assertEqual(str(geterror()), emsg)
         else:   
             self.fail("no exception")
         try:
             snd = mixer.Sound(buffer=[])
         except TypeError:
             emsg = 'Expected object with buffer interface: got a list'
             self.assertEqual(str(geterror()), emsg)
         else:
             self.fail("no exception")
         ufake_path = unicode_('12345678')
         self.assertRaises(pygame.error, mixer.Sound, ufake_path)
         try:
             mixer.Sound(buffer=unicode_('something'))
         except TypeError:
             emsg = 'Unicode object not allowed as buffer object'
             self.assertEqual(str(geterror()), emsg)
         else:
             self.fail("no exception")
         self.assertEqual(get_bytes(mixer.Sound(buffer=sample)), sample)
         self.assertEqual(get_bytes(mixer.Sound(sample)), sample)
         self.assertEqual(get_bytes(mixer.Sound(file=bwave_path)), snd_bytes)
         self.assertEqual(get_bytes(mixer.Sound(bwave_path)), snd_bytes)
         
         snd = mixer.Sound(wave_path)
         try:
             mixer.Sound(wave_path, array=snd)
         except TypeError:
             self.assertEqual(str(geterror()), arg_emsg)
         else:
             self.fail("no exception")
         try:
             mixer.Sound(buffer=sample, array=snd)
         except TypeError:
             self.assertEqual(str(geterror()), arg_emsg)
         else:
             self.fail("no exception")
         snd2 = mixer.Sound(array=snd)
         self.assertEqual(snd.get_buffer().raw, snd2.get_buffer().raw)
         
     finally:
         mixer.quit()
Пример #50
0
Color = color.Color
import pygame.bufferproxy
BufferProxy = bufferproxy.BufferProxy
import pygame.math
Vector2 = pygame.math.Vector2
Vector3 = pygame.math.Vector3

__version__ = ver

# next, the "standard" modules
# we still allow them to be missing for stripped down pygame distributions
_import_failed = False
try:
    import pygame.cdrom
except (ImportError, IOError):
    _import_failed = geterror()
if _import_failed:
    cdrom = MissingModule("cdrom", geterror(), 1)

_import_failed = False
try:
    import pygame.cursors
except (ImportError, IOError):
    _import_failed = geterror()
if _import_failed:
    cursors = MissingModule("cursors", geterror(), 1)

_import_failed = False
try:
    import pygame.display
except (ImportError, IOError):
Пример #51
0
#first, the "required" modules
from pygame.base import *
from pygame.constants import *
from pygame.version import *
from pygame.rect import Rect
from pygame.compat import geterror
from pygame.rwobject import encode_string, encode_file_path
import pygame.surflock
import pygame.color
Color = color.Color
__version__ = ver

#next, the "standard" modules
#we still allow them to be missing for stripped down pygame distributions
try: import pygame.math
except (ImportError,IOError):math=MissingModule("math", geterror(), 1)

try: import pygame.cdrom
except (ImportError,IOError):cdrom=MissingModule("cdrom", geterror(), 1)

try: import pygame.cursors
except (ImportError,IOError):cursors=MissingModule("cursors", geterror(), 1)

try: import pygame.display
except (ImportError,IOError):display=MissingModule("display", geterror(), 1)

try: import pygame.draw
except (ImportError,IOError):draw=MissingModule("draw", geterror(), 1)

try: import pygame.event
except (ImportError,IOError):event=MissingModule("event", geterror(), 1)
Пример #52
0
from pygame.version import *
from pygame.rect import Rect
from pygame.compat import geterror
import pygame.rwobject
import pygame.surflock
import pygame.color

Color = color.Color
__version__ = ver

# next, the "standard" modules
# we still allow them to be missing for stripped down pygame distributions
try:
    import pygame.cdrom
except (ImportError, IOError):
    cdrom = MissingModule("cdrom", geterror(), 1)

try:
    import pygame.cursors
except (ImportError, IOError):
    cursors = MissingModule("cursors", geterror(), 1)

try:
    import pygame.display
except (ImportError, IOError):
    display = MissingModule("display", geterror(), 1)

try:
    import pygame.draw
except (ImportError, IOError):
    draw = MissingModule("draw", geterror(), 1)