Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 1251

Python • Pygame on Raspberry Pi looks very weird

$
0
0
I tried running this script on my RasPi, it should create a red rect on black background:

game.py:

Code:

import pygameimport syspygame.init()screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN)screen_width, screen_height = screen.get_size()pygame.display.set_caption("RasPi")running = Truewhile running:    for event in pygame.event.get():        if event.type == pygame.QUIT:            running = False        elif event.type == pygame.KEYDOWN:            if event.key == pygame.K_ESCAPE:                running = False    pygame.draw.rect(screen, (255, 0, 0), (20, 20, 20, 20))    pygame.display.flip()    pygame.time.Clock().tick(60)pygame.quit()sys.exit()
this is the output:
https://ibb.co/gFvk7sX

Does someone know, why this is?

Statistics: Posted by TOTOskiller — Sat Oct 26, 2024 5:22 pm



Viewing all articles
Browse latest Browse all 1251

Trending Articles