コード例 #1
0
def add_music(self):
    import tkinter as tk
    from tkinter import filedialog
    rt = tk.Tk()
    rt.withdraw()
    global  filename
    filename = filedialog.askopenfilename()
    print(filename)
    listofsongs.insert(index,filename)
    print(listofsongs)
    listbox.insert(index,filename)
    rt.mainloop()
コード例 #2
0
ファイル: mplay.py プロジェクト: Yobmod/dmltests
        self.rewindPhoto = PhotoImage(file=self.assets_path + '/icons/rewind.png')
        rewindBtn = Button(self.bottomframe, image=self.rewindPhoto, command=self.rewind_music)
        rewindBtn.grid(row=0, column=0)

        self.scale = Scale(self.bottomframe, from_=0, to=100, orient=HORIZONTAL, command=self.set_vol)
        self.scale.set(self.init_vol)
        mixer.music.set_volume(self.init_vol / 100)
        self.scale.grid(row=0, column=2, pady=15, padx=30)

    def on_closing(self) -> None:
        try:
            self.stop_music()
            self.parent.destroy()
        except Exception as e:
            if DEBUG: print(e)
        else:
            print('App closed')


if __name__ == "__main__":
    try:
        root = tk.ThemedTk()
        root.get_themes()                 # Returns a list of all themes that can be set
        root.set_theme("plastik")
    except AttributeError as e:
        root = tk.Tk()
        if DEBUG: print("Themed Tk not loaded")
    finally:
        mplay_app = Mplay(root, title="DML Music Player")
        root.mainloop()