May-14-2019, 06:51 PM
Hi guys i have been absent for a while do to house changing. I'm back now, trying to finish my python program. This are two audio commands in my program. When the audio starts some of them take a while to terminate. So i was thinking to create an "emergency button" to terminate any running audio. Both for playsound or pygame. How can i do that. The button is already created, just have no ideia what command to apply (the program itself is not to be terminated, just any playing sounds)
def nenebot_en(): thread_pool_executor = futures.ThreadPoolExecutor(max_workers=1) def playmp3(file): playsound(file) file = 'nenebot_info_en.mp3' thread_pool_executor.submit(playmp3, file)
pygame.init() pygame.mixer.init() pygame.mixer.music.load("erro_pt.mp3") pygame.mixer.music.play(0) time.sleep(2) pygame.mixer.music.load("error_en.mp3") pygame.mixer.music.play(0) time.sleep(2) pygame.mixer.quit()