[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Switching between fullscreen and windowed mode?



How can I switch between windowed and fullscreen mode? I don't want to
use pygame.display.toggle_fullscreen (because it doesn't seem to work
with my code) and pygame.display.set_mode(resolution,
pygame.FULLSCREEN) doesn't make a windowed version of my game when I
restart it.

Here's the some of the code I'm currently trying to get to work:
if e.key == K_F10:
				isFullScreen = self.settings['fullScreen']
				isFullScreen = int(not isFullScreen)

				# try to change the mode
				base.setScreenMode((0,pygame.FULLSCREEN)[isFullScreen],int(self.settings['bpp']))
				# save changes
				self.settings['fullScreen'] = isFullScreen
				base.saveGameSettings(self.settings)
				return 1

self.settings["fullscreen"] can be either 1 for True or 0 for False.
Thanks,
Joe
--
All Your Base Are Belong To Us!!! chown -r us ./base

"After three days without programming, life becomes meaningless.'' --
Tao of Programming Book 2