This question already has answers here:
Pygame unresponsive display
(1 answer)
Pygame window not responding after a few seconds
(3 answers)
Closed 2 years ago.
I just made a pygame when you click the screen it changes the color to a random color stored in a variable called backgroundColor. At the beginning of the while loop it does display.fill(backgroundColor) .
I started clicking the screen really fast. But after about 8,000 cycles the screen turns white and stops doing anything. Does anyone know why the game crashes after so many color changes.
Related
This question already has answers here:
Spawning multiple instances of the same object concurrently in python
(1 answer)
Is there a way to have different tick rates for differents parts of my code in pygame?
(1 answer)
Closed 9 months ago.
I am making a game in python using pygame in which you click a candy and you get candies. This game is similar to the famous game 'Cookie Clicker'. I've got the clicking part done but I have no idea how to do the auto candies per second. If anybody knows how to do this, please tell me.
This question already has answers here:
tips on Adding/creating a drop down selection box in pygame
(1 answer)
trying creating dropdown menu pygame, but got stuck
(1 answer)
Closed 5 months ago.
So i'm making a GUI with pygame, with some game elements that I need pygame to do.
But I need to make a context menu on right click.
It doesn't have to be in pygame, it could be a command in the os or sys modules. I just need a way to open one of these menus, and I can activate it on right click.
Sorry if my question is not clear, I really don't know how to explain it.
This question already exists:
Entry Field Question - Closing the Window but keeping Python Running [duplicate]
Closed 2 years ago.
I have tried looking around a lot for a solution from other questions but I am not sure I could accurately implement them into my program. So I decided to ask here.
Is there a simple way to close a window in pygame whilst keeping pygame opening and able to complete tasks?
I use:
pygame.quit()
But it quits the program.
Anyone got an idea?
do pygame.display.quit() to close the window without leaving pygame
This question already has answers here:
Countdown timer in Pygame
(8 answers)
Closed 5 years ago.
Would anyone know how you would code a timer to be displayed on screen in pygame, where the time is going up as the user is playing?
This link might be helpful
http://www.pygame.org/docs/ref/time.html#pygame.time.get_ticks
You can do something like this
start_ticks=pygame.time.get_ticks()
while mainloop:
seconds=(pygame.time.get_ticks()-start_ticks)/1000
if seconds>10:
break
This question already has answers here:
how to play wav file in python?
(5 answers)
How can I play an mp3 with pygame?
(7 answers)
Closed 2 years ago.
i have a sound file with a delay in it that plays with pygame.
menu_sound = pygame.mixer.Sound('sounds/Devastation.ogg')
#these lines are not next to each other in my code, i just picked out relevant lines.
menu_sound.play(-1)
there is about a 4 second delay. how can i force pygame to play the music starting at 4 seconds? i have looked at the mixer module documentation and can't find anything.
Python 3.3.3, windows