Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hiding pygame display

Tags:

python

pygame

Is there any way to hide the screen of 'pygame.display' and to make it visible afterwards without calling 'pygame.display.quit()'?

like image 456
Serban Razvan Avatar asked May 05 '12 22:05

Serban Razvan


People also ask

How do you hide the screen on pygame?

All you can do is minimize the window using pygame. display. iconify() .

How do you change display mode in pygame?

Setting the display mode is handled with the function pygame. display. set_mode((width, height), flags, depth) Initialize a window or screen for display. The only required argument in this function is a sequence containing the width and height of the new display mode.

What does pygame display flip do?

display. flip() for software displays. It allows only a portion of the screen to updated, instead of the entire area. If no argument is passed it updates the entire Surface area like pygame.


1 Answers

import os
os.environ["SDL_VIDEODRIVER"] = "dummy"

would be enough. See:

http://www.pygame.org/wiki/HeadlessNoWindowsNeeded
https://github.com/ntasfi/PyGame-Learning-Environment/issues/26#issuecomment-330440199

like image 158
Chris Jeong Avatar answered Nov 19 '22 20:11

Chris Jeong