Bottom Page

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()
Quote
#2
Well, no administrator available, no one else, can answer this. Congrats all
Quote
#3
It is difficult to help you,
if you only publish part of your code.
The best a minimal runable script with your issue.
Quote

Top Page

Forum Jump:


Users browsing this thread: 1 Guest(s)