Skip to content

Resize doesn't work after fullscreen #3107

@MainBreezy

Description

@MainBreezy

Windows - Python 3.10.2 :

  • **Pygame 2.1.2

Current behavior:
After exiting from fullscreen the ability to resize the window disappears

Expected behavior:
I wanted the window to be able to be resized after exiting fullscreen

Screenshots

Expected:
image

Current:
image

Steps to reproduce:
Code below

Test code

If possible add a simple test program that shows the problem described in this report.

import pygame
import tkinter as tk
import sys

pygame.init()

root = tk.Tk()
screenWidth = root.winfo_screenwidth()
screenHeight = root.winfo_screenheight()
mainClock = pygame.time.Clock()
pygameIcon = pygame.image.load(r"C:/Users/Chris/OneDrive/Desktop/MyPython/Sprites/Reeses Puffs.png")

fullscreen = False
running = True

pygame.display.set_caption("Test Game")
pygame.display.set_icon(pygameIcon)
screen = pygame.display.set_mode((screenWidth-100, screenHeight-100), pygame.RESIZABLE)


def menu():
    global running
    global screen
    global fullscreen

    while running:
        for event in pygame.event.get():
            if event.type == pygame.VIDEORESIZE:
                if not fullscreen:
                    screen = pygame.display.set_mode((event.w, event.h), pygame.RESIZABLE)
            if event.type == pygame.KEYDOWN:
                if event.key == pygame.K_F11:
                    fullscreen = not fullscreen
                    if fullscreen:
                        pygame.display.set_mode((screen.get_width(), screen.get_height()), pygame.FULLSCREEN)
                    else:
                        pygame.display.set_mode((screen.get_width(), screen.get_height()), pygame.RESIZABLE)
                elif event.key == pygame.K_ESCAPE:
                    quitAll()
            if event.type == pygame.QUIT:
                quitAll()

        pygame.display.flip()
        pygame.display.update()


def quitAll():
    global running
    running = False


menu()

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions