def __init__(self, **kwargs):
        super(TicTacToe, self).__init__(**kwargs)

        self.x_pic_location = "pics/x_gold.png"
        self.o_pic_location = "pics/o_gold.png"
        self.button_start = "pics/blue_But_square.png"
        self.reset_exit = "pics/blue_gloss.png"

        self.Xturn = True
        self.buttons_pressed = 0
        self.game_done = False

        self.button_layout = GridLayout(cols=3, rows=3)
        self.display = BoxLayout(orientation="vertical")

        self.message = Label(text="Player 1's turn")

        exit_button = Button(text="Exit")
        exit_button.background_normal = self.reset_exit
        exit_button.bind(on_press=self.Exit)

        reset_button = Button(text="Reset")
        reset_button.background_normal = self.reset_exit
        reset_button.bind(on_press=self.Reset)

        self.display.add_widget(self.message)
        self.display.add_widget(exit_button)
        self.display.add_widget(reset_button)

        self.add_widget(self.display)

        for x in xrange(9):

            b = CustomTTTButton(border=[0, 0, 0, 0],
                                background_normal=self.button_start)
            b.bind(on_press=self.PlayerPokesButton)
            self.button_layout.add_widget(b)

        #self.button_layout.background_color = [1,0,0,1]

        self.add_widget(self.button_layout)

        x_sound = s.Mp3File("sms-alert-2-daniel_simon.mp3", 3)
        o_sound = s.Mp3File("sms-alert-5-daniel_simon.mp3", 3)
        draw_sound = s.Mp3File("Sad_Trombone-Joe_Lamb-665429450.mp3", 3)
        victory_sound = s.Mp3File("glass_ping-Go445-1207030150.mp3", 3)

        self.x_id = PiMusic.CreateEntry(x_sound)
        self.o_id = PiMusic.CreateEntry(o_sound)
        self.draw_id = PiMusic.CreateEntry(draw_sound)
        self.victory_id = PiMusic.CreateEntry(victory_sound)
Exemple #2
0
def SoundFromFileCode(name, duration):

    SoundFile = NULL

    filecode = IsFile(name)

    if (filecode == 4):
        SoundFile = Sound.WavFile(name, duration)

    elif (filecode == 3):
        SoundFile = Sound.Mp3File(name, duration)

    elif (filecode == 2):
        SoundFile = Sound.SoundFont2File(name, duration)

    elif (filecode == 1):
        SoundFile = Sound.MidiFile(name, duration)
    else:
        pass

    return SoundFile