Python Forum
[PyGUI] Shutdown any audio command - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [PyGUI] Shutdown any audio command (/thread-18368.html)



Shutdown any audio command - francisco_neves2020 - May-14-2019

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()



RE: Shutdown any audio command - francisco_neves2020 - May-31-2019

Well, no administrator available, no one else, can answer this. Congrats all


RE: Shutdown any audio command - heiner55 - May-31-2019

It is difficult to help you,
if you only publish part of your code.
The best a minimal runable script with your issue.