creating a resizing window - pygame - python - dynamic resize able window part 1

preview_player
Показать описание
Since I studied software engineering I decided to do some programming in my holidays so im currently making a game, will update with more videos later. I also decided that i would start making basic tutorials for things i found hard when learning python.

leave a comment if you wish to have a tutorial on a specific part of one of my videos, or want me to do a tutorial video on something you're having trouble with.

contact me on here with any queries.


Рекомендации по теме
Комментарии
Автор

Really helped when stack overflow couldn't. Awesome video!

thememesarealive
Автор

This does not work. Copied the code in verbatim and the screen is not resizable. I also get this error:

line 11, in <module>
pygame.event.pump()
pygame.error: video system not initialized

The code:


import pygame
from pygame.locals import *
pygame.init()

screen = pygame.display.set_mode((500, 500),
pic =
screen.blit(pygame.transform.scale(pic, (500, 500)), (0, 0))
pygame.display.flip()

while True:
pygame.event.pump()
event = pygame.event.wait()
if event.type == QUIT:
pygame.display.quit()
elif event.type == VIDEORESIZE:
screen = pygame.display.set_mode(event.dict['size'],
screen.blit(pygame.transform.scale(pic, event.dict['size']), (0, 0))
pygame.display.flip()

randomnumbers