Is there a way to close a window without quitting pygame [duplicate] - python

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

Related

How to get automatic stuff per second in my game [duplicate]

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.

Use python to open right click menu [duplicate]

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.

Pygame keeps crashing [duplicate]

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.

How do I clear the output screen in python? [duplicate]

This question already has answers here:
Clear terminal in Python [duplicate]
(27 answers)
Closed 4 years ago.
I am making a text based rpg in python 3 and the output window gets very cluttered cluttered. I was wondering if there was a way to clear the screen automatically from time to time.
import os
os.system('cls')
You can use os.system('clear') if you are on linux.

Python: Is it possible to make a tkinter program on top of all windows? [duplicate]

This question already has answers here:
How to make a Tkinter window jump to the front?
(12 answers)
Closed 6 years ago.
is there any way to make a tkinter program on top of all windows? Like switching to a new window will not minimize or put the tkinter program back, thanks!
Yes. You just need to set the window manager attribute topmost:
mywindow.wm_attributes("-topmost", True)

Categories

Resources