Python Forum

Full Version: Pygame
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
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.
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.

[attachment=1388]

I changed it to:

[attachment=1389]

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