Quick answer: Use pygame.display.set_mode(size, FULLSCREEN) to switch fullscreen explicitly. Reload sprite surfaces with convert_alpha() after the mode change to refresh format binding.
F11 toggles your Pygame window to fullscreen. The window goes fullscreen correctly. But every sprite renders as white squares or with corrupted colors. Surface references survived the toggle but their pixel format binding didn’t.
Surface Format Binding
Surfaces returned from convert_alpha are bound to the display’s pixel format at convert time. Changing display mode (windowed → fullscreen) can change the underlying format. The surfaces are now bound to the old format; blits read wrong bytes.
The Fix: Reload After Mode Change
def toggle_fullscreen():
flags = pygame.display.get_surface().get_flags()
if flags & pygame.FULLSCREEN:
pygame.display.set_mode((800, 600))
else:
pygame.display.set_mode((1920, 1080), pygame.FULLSCREEN)
reload_all_sprites()
def reload_all_sprites():
for key, path in sprite_paths.items():
sprites[key] = pygame.image.load(path).convert_alpha()
After mode change, reload images so convert_alpha re-binds them to the new display format.
SCALED Avoids the Problem
screen = pygame.display.set_mode(
(800, 600),
pygame.SCALED | pygame.RESIZABLE,
vsync=1
)
# Toggle fullscreen at any point:
pygame.display.toggle_fullscreen()
SCALED keeps the logical 800×600 surface; the display layer scales to whatever physical size. Fullscreen toggle just changes the physical scaling target, not the underlying surface. No format mismatch.
SCALED is the modern default
For new projects, always use SCALED. The traditional set_mode/toggle_fullscreen pattern is more fragile and forces you to manage format reloads. SCALED + toggle_fullscreen does the right thing automatically.
Verifying
Toggle fullscreen repeatedly. Sprites should render correctly each time, with no white squares or corrupted colors. Confirm visually after each toggle.
“Surface format depends on display mode. Reload after mode change, or use SCALED to insulate from the change.”
SCALED + RESIZABLE + vsync is the boilerplate set_mode for any new Pygame project. Avoids most display-related surprises.