Opening a resizable window in Pygame in Fullscreen

2019-07-30 00:39发布

I'm making a firework simulation in pygame, and I want to be able to run the program, and have it open up in full screen. Not the pygame.FULLSCREEN, I still want to be able to use pygame.QUIT.
I don't know if this is possible, but if anyone could help, please share your ideas!

Here's my code for the screen:

import pygame
screen = pygame.display.set_mode((0, 0), pygame.RESIZABLE)

1条回答
Anthone
2楼-- · 2019-07-30 00:58

You could use the width and height of the screen to setup the resolution, like in this post, by using the VideoInfo object provided by pygame:

import pygame

pygame.init()
video_infos = pygame.display.Info()
width, height = video_infos.current_w, video_infos.current_h
screen = pygame.display.set_mode((width, height), pygame.RESIZABLE)
# [...]
查看更多
登录 后发表回答