Reputation: 111
So I recently installed pygame and started learning off youtube. The code that the youtuber was working on:
import pygame
# Initialize the pygame
pygame.init()
# create the screen
screen = pygame.display.set_mode((800, 600))
# Title and Icon
pygame.display.set_caption("Space Invaders")
icon = pygame.image.load('ufo.png')
pygame.display.set_icon(icon)
# Game loop
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
However, when he runs this, he gets a blank screen that runs, which is a result of "pygame.display.set_mode".
But on my Mac, there is no blank screen, the Python Launcher simply jumps up and down on the dock without any display (there is no error showed either), anyone can help me understand why this is?
Basically what it looks like when I run it: The python launcher just jumps up and down in the dock -
Upvotes: 1
Views: 997
Reputation: 11
import pygame
pygame.init()
screen = pygame.display.set_mode((800,600))
Upvotes: 1
Reputation: 78
Ted Klein Bergman comment is right. Put pygame.display.update()
in your loop.
Upvotes: 1