Ejemplo n.º 1
0
    def __init__(self, directory, screen=None, sound=0):

        # Load the images.

        self.images = image.Images(os.path.join(directory, "Pictures"),
                                   self.image_files,
                                   self.image_names,
                                   screen=screen)

        # Load the mouse cursor shape.
        self.cursors = image.Cursors(os.path.join(directory, "Pictures"),
                                     [("cross_cursor.xbm", "cross_mask.xbm")],
                                     ["cross"])

        # Store and check the sound system status.
        self.sound_status = sound_status

        #print "Sound:", ['off', 'on'][sound_status]

        # Set the number of channels to use.
        pygame.mixer.set_num_channels(8)

        if pygame.mixer.get_num_channels() == 0:

            self.sound_status = 0

        if self.sound_status == 1:

            # Load the sound samples.
            self.samples = {}

            for name, filename in self.sample_defs.items():

                # Initialise each sound and store it in the samples
                # dictionary.
                file = os.path.join(directory, "Sounds", filename)

                try:
                    sample = pygame.mixer.Sound(file)
                    self.samples[name] = sample

                except pygame.error:

                    # Ensure that an entry for this name is created.
                    self.samples[name] = None
Ejemplo n.º 2
0
 def __init__(self):
     super().__init__()
     self.image = image.Images()
     self.pixmap = ''
     self.initUI()