Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Queue in Pygame
#1
Hi

I work on audio player, I use Tkinter for GUI and Pygame for media.

I would like to make a playlist of songs and to play them with pygame.mixer.music

There is a function "queue()", but it doesn't work, actually. In fact, it can take only one song in queue, no more.

So, what I can do? I tried to implement it throut loop:

	running = True;

			while running:

				if (self.mixer.get_busy() == False and files != False):
					self.mixer.load ( self.playlist[files.pop()] )
					self.mixer.play(1)
					
					if (files == False):
						running = False;
						break;
but the problem is that user can't interact with GUI until the loop breaks. It means that user is not able to pause music or stop it.

How I can solve this problem with Pygame? Or it is better to use other library ?

P.S. I browsed GitHub, it turned out that people make audio players with pygame, but it doesn't support playing a playlist of songs.
Reply


Messages In This Thread
Queue in Pygame - by constantin01 - Jan-07-2020, 02:45 PM
RE: Queue in Pygame - by metulburr - Jan-07-2020, 04:02 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  task queue Valon1981 8 3,614 Jul-07-2020, 07:41 AM
Last Post: freeman
  Queue maxsize mr_byte31 2 4,568 Sep-03-2019, 07:02 PM
Last Post: mr_byte31
  Queue.Queue() would not reduce capacity after get() yuan8421 9 11,107 Jan-02-2018, 09:38 PM
Last Post: Windspar
  Threading and Queue nexusfactor 5 4,292 Oct-16-2017, 04:14 PM
Last Post: Larz60+
  Pygame*import pygame ImportError: No module named pygame CASPERHANISCH 1 9,763 Jun-05-2017, 09:50 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

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