Пример #1
0
    def PlayerPlaybackGUIStart(self, NumFiles=1):
        # -------  Make a new FlexForm  ------- #

        image_pause = './ButtonGraphics/Pause.png'
        image_restart = './ButtonGraphics/Restart.png'
        image_next = './ButtonGraphics/Next.png'
        image_exit = './ButtonGraphics/Exit.png'

        self.TextElem = sg.T('Song loading....',
                             size=(70, 5 + NumFiles),
                             font=("Helvetica", 14),
                             auto_size_text=False)
        self.SliderElem = sg.Slider(range=(1, 100),
                                    size=(50, 8),
                                    orientation='h',
                                    text_color='#f0f0f0')
        layout = [[
            sg.T('MIDI File Player', size=(30, 1), font=("Helvetica", 25))
        ], [self.TextElem], [self.SliderElem],
                  [
                      sg.ReadFormButton('PAUSE',
                                        button_color=sg.TRANSPARENT_BUTTON,
                                        image_filename=image_pause,
                                        image_size=(50, 50),
                                        image_subsample=2,
                                        border_width=0),
                      sg.T(' '),
                      sg.ReadFormButton('NEXT',
                                        button_color=sg.TRANSPARENT_BUTTON,
                                        image_filename=image_next,
                                        image_size=(50, 50),
                                        image_subsample=2,
                                        border_width=0),
                      sg.T(' '),
                      sg.ReadFormButton('Restart Song',
                                        button_color=sg.TRANSPARENT_BUTTON,
                                        image_filename=image_restart,
                                        image_size=(50, 50),
                                        image_subsample=2,
                                        border_width=0),
                      sg.T(' '),
                      sg.SimpleButton(
                          'EXIT',
                          button_color=sg.TRANSPARENT_BUTTON,
                          image_filename=image_exit,
                          image_size=(50, 50),
                          image_subsample=2,
                          border_width=0,
                      )
                  ]]

        window = sg.FlexForm('MIDI File Player',
                             default_element_size=(30, 1),
                             font=("Helvetica", 25)).Layout(layout).Finalize()
        self.Window = window
Пример #2
0
    def PlayerChooseSongGUI(self):

        # ---------------------- DEFINION OF CHOOSE WHAT TO PLAY GUI ----------------------------

        layout = [[
            sg.Text('MIDI File Player',
                    font=("Helvetica", 15),
                    size=(20, 1),
                    text_color='green')
        ], [sg.Text('File Selection', font=("Helvetica", 15), size=(20, 1))],
                  [
                      sg.Text('Single File Playback', justification='right'),
                      sg.InputText(size=(65, 1), key='midifile'),
                      sg.FileBrowse(size=(10, 1),
                                    file_types=(("MIDI files", "*.mid"), ))
                  ],
                  [
                      sg.Text('Or Batch Play From This Folder',
                              auto_size_text=False,
                              justification='right'),
                      sg.InputText(size=(65, 1), key='folder'),
                      sg.FolderBrowse(size=(10, 1))
                  ], [sg.Text('_' * 250, auto_size_text=False, size=(100, 1))],
                  [
                      sg.Text('Choose MIDI Output Device', size=(22, 1)),
                      sg.Listbox(values=self.PortList,
                                 size=(30, len(self.PortList) + 1),
                                 key='device')
                  ], [sg.Text('_' * 250, auto_size_text=False, size=(100, 1))],
                  [
                      sg.SimpleButton('PLAY',
                                      size=(12, 2),
                                      button_color=('red', 'white'),
                                      font=("Helvetica", 15),
                                      bind_return_key=True),
                      sg.Text(' ' * 2, size=(4, 1)),
                      sg.Cancel(size=(8, 2), font=("Helvetica", 15))
                  ]]

        window = sg.Window('MIDI File Player',
                           auto_size_text=False,
                           default_element_size=(30, 1),
                           font=("Helvetica", 12)).Layout(layout)
        self.Window = window
        return window.Read()