question about my Pygame code - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Game Development (https://python-forum.io/forum-11.html) +--- Thread: question about my Pygame code (/thread-36305.html) |
question about my Pygame code - Than999 - Feb-06-2022 Hi everyone, I am trying to learn about the Pygame framework by following this Medium article. However, my code so far only shows the game window screen for a split second and then it closes out. I know that as long as my while loop boolean remains "True" it should keep the window screen open until the player exits out the screen. I am not sure why it keeps running to completion and closes by itself. Any or help or suggestions would be greatly appreciated. Thanks! import pygame pygame.init() screen = pygame.display.set_mode((500, 500)) pygame.display.set_caption('Pygame from Medium') done = False while not done: for event in pygame.get(): if event.type == pygame.QUIT: done = True pygame.display.flip() RE: question about my Pygame code - BashBedlam - Feb-06-2022 for event in pygame.event.get () :Instead of... for event in pygame.get () : RE: question about my Pygame code - Than999 - Feb-06-2022 (Feb-06-2022, 06:41 PM)BashBedlam Wrote:for event in pygame.event.get () :Instead of... Thanks! |