Python Forum
[PyGUI] Shutdown any audio command
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGUI] Shutdown any audio command
#1
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()
Reply
#2
Well, no administrator available, no one else, can answer this. Congrats all
Reply
#3
It is difficult to help you,
if you only publish part of your code.
The best a minimal runable script with your issue.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020