python 2.7 - Can you play sound in windows while doing another task simultaneously? -
is there way while playing winsound.playsound("some sound", flags) change photolabel? i've been trying , no matter put play sound play sound before changing photo label.
my code:
def thriller(self): winsound.playsound("thriller.wav", winsound.snd_nodefault) img5 = imagetk.photoimage(image.open('thriller.jpg')) self.photolabel.configure(image = img5) self.photolabel.image = img5 self.original_board() def original_board(self): pil import image, imagetk self.image = image.open("board.jpg") self.photo = imagetk.photoimage(self.image) self.photolabel.after(5000, lambda: self.photolabel.configure(image=self.photo))
yes can. have play sound asynchronly. flag winsound.snd_async should work. if not help, can spawn winsound function in new thread (or in python better new process) such played @ same time image changes.
good luck!
Comments
Post a Comment