This is some code I wrote for a music program... Any way on making it neater/more pythonic?
from Tkinter import *
import pygame
playlist=[]
pygame.init()
pygame.mixer.init()
camera=pygame.mixer.Sound("E:\\Peter\\Python_stuff\\data\\Music\\camera1.wav")
one=pygame.mixer.Sound("E:\\Peter\\Python_stuff\\data\\Music\\one.wav")
wrong=pygame.mixer.Sound("E:\\Peter\\Python_stuff\\data\\Music\\wrong.wav")
root=Tk()
root.title("DJ Pro")
def sound_play(event=None):
playlist.append(wrong)
wrong.play()
def sound_play1(event=None):
playlist.append(one)
one.play()
def sound_play2(event=None):
playlist.append(camera)
camera.play()
def play_all(event=None):
for ii in playlist:
ii.play()
while True:
if not pygame.mixer.get_busy():
break
def reset(event=None):
global playlist
playlist=[]
sound1=Button(master=root, text="wrong", command=sound_play)
sound1.pack()
sound2=Button(master=root, text="one", command=sound_play1)
sound2.pack()
sound3=Button(master=root, text="camera", command=sound_play2)
sound3.pack()
sound4=Button(master=root, text="play", command=play_all)
sound4.pack()
sound5=Button(master=root, text="restart", command=reset)
sound5.pack()
root.mainloop()
thanks!
edit: Also, is there an audio package for combining music files? It is possible to do it by removing meta-data then combining them but I'd rather not...