Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Pygame
#1
Music 
I'm programming a simple music player using python 3.10, pyqt6, and pygame. My question is about the following line of code:

screen = pygame.display.set_mode((1, 1))

Without this line of code, I get the following error:

--> Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "C:/Users/mount/source/repos/MyDashboard/bass_player.pyw", line 92, in playsong
for event in pygame.event.get():
pygame.error: video system not initialized

The event being watched for is MUSIC ENDED, ie:
MUSIC_ENDED = pygame.USEREVENT

With the line of code, I get a small window in the center of the display as well as my pyqt6 GUI (different screen location). I don't want the small window to display, at all. My Gui shows 5 music player buttons with no output display. (see attachment)

Can I have the pygame window open minimized or otherwise not be shown? Thank you.

Attached Files

Thumbnail(s)
   
Reply
#2
I have since found two separate ways to solve the above problem.

First:

import pygame
from pygame import mixer

mixer.init() <-- Changed to pygame.init(). Then deleted --> screen = pygame.display.set_mode((1, 1))

Second: I had this snippet to discover the end of a song.

   

I changed it to:

   

I prefer the first solution, obviously. Thank you to all who viewed my original post.
Reply


Forum Jump:

User Panel Messages

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