I am making a game with the pygame module and now I have a problem. The program itself works fantastically, but the full-screen mode that I wanted to enable does not work. I made a test program for full-screen mode, which works fine, but when I tried to make full-screen game mode, the display is very strange. The program starts first. You can see how it enters full-screen mode and displays a text saying: "Loading ..." Then the window disappears and the original size appears in it without full-screen mode. the explorer panel at the bottom of the screen is displayed twice, and then the analyzer panel 2e disappears. The game then starts in non-full screen mode. This is the program I use:
import pygame, sys, os
from pygame.locals import *
pygame.mixer.pre_init(44100, -16, 4, 2048)
pygame.init()
DISPLAYSURF = pygame.display.set_mode((476, 506), FULLSCREEN)
pygame.display.set_caption('Title of the game')
DISPLAYSURF.fill((128,128,128))
FONT = pygame.font.Font('freesansbold.ttf',20)
LoadingText = FONT.render('Loading...', True, (0,255,0))
LoadingRect = LoadingText.get_rect()
LoadingRect.center = (238,253)
DISPLAYSURF.blit(LoadingText, LoadingRect)
pygame.display.update()
try:
os.remove('LOAD.txt')
except IOError:
pass
try:
os.remove('OPEN.txt')
except IOError:
pass
try:
os.remove('RUN.txt')
except IOError:
pass
try:
os.remove('TEMP.txt')
except IOError:
pass
import ROIM
import ROIM_CreateNewGame
import ROIM_LevelMenu
import ROIM_Menu
import ROIM_SmallMenus
import ROIM_GameIntroduction
import SetupController
Run = 'Menu'
RUN = open('RUN.txt','w')
RUN.write('RUN\n')
RUN.write(Run)
RUN.close()
ChangeRun = False
FPS = 35
fpsClock = pygame.time.Clock()
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
Preferences = open('Preferences.txt')
PreferencesLines = Preferences.read().split('\n')
x = 1
Volume = -1
Brightness = -1
for Item in PreferencesLines:
if Item == 'BRIGHTNESS':
Brightness = int(PreferencesLines[x])
if Item == 'VOLUME':
Volume = int(PreferencesLines[x])
x += 1
Preferences.close()
assert Volume != -1
assert Brightness != -1
GREEN = (0,255 * (Brightness / 100),0)
YELLOW = (255 * (Brightness / 100),255 * (Brightness / 100),0)
RED = (255 * (Brightness / 100),0,0)
BLUE = (0,0,255 * (Brightness / 100))
WHITE = (255 * (Brightness / 100),255 * (Brightness / 100),255 * (Brightness / 100))
BLACK = (0,0,0)
GREY = (128 * (Brightness / 100),128 * (Brightness / 100),128 * (Brightness / 100))
if Run == 'Menu':
ROIM_Menu.RunMenu(FONT, ChangeRun, GREEN, YELLOW, RED, BLUE, WHITE, BLACK, GREY, DISPLAYSURF, Volume, Brightness, fpsClock, FPS)
elif Run == 'NewGame':
ROIM_CreateNewGame.RunNewGame(FONT, ChangeRun, GREEN, YELLOW, RED, BLUE, WHITE, BLACK, GREY, DISPLAYSURF, Volume, Brightness, fpsClock, FPS)
elif Run == 'Game':
ROIM.RunGame(FONT, ChangeRun, GREEN, YELLOW, RED, BLUE, WHITE, BLACK, GREY, DISPLAYSURF, Volume, Brightness, fpsClock, FPS)
elif Run == 'SmallMenu':
ROIM_SmallMenus.RunSmallMenu(FONT, ChangeRun, GREEN, YELLOW, RED, BLUE, WHITE, BLACK, GREY, DISPLAYSURF, Volume, Brightness, fpsClock, FPS)
elif Run == 'LevelMenu':
ROIM_LevelMenu.RunLevelMenu(FONT, ChangeRun, GREEN, YELLOW, RED, BLUE, WHITE, BLACK, GREY, DISPLAYSURF, Volume, Brightness, fpsClock, FPS)
elif Run == 'Introduction':
ROIM_GameIntroduction.RunIntro(FONT, ChangeRun, GREEN, YELLOW, RED, BLUE, WHITE, BLACK, GREY, DISPLAYSURF, Volume, Brightness, fpsClock, FPS)
elif Run == 'Setup':
SetupController.Run_Controller_Setup(FONT, ChangeRun, GREEN, YELLOW, RED, BLUE, WHITE, BLACK, GREY, DISPLAYSURF, Volume, Brightness, fpsClock, FPS)
else:
assert False
ChangeRun = False
RUN = open('RUN.txt')
assert RUN.readline() == 'RUN\n'
Run = RUN.readline().split('\n')[0]
RUN.close()
, .
DISPLAYSURF . , pygame.display.set_mode().
windows 8 python 3.4.
, ?
, .