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

Python • Re: Pygame on Raspberry Pi looks very weird

$
0
0
Try this:

Code:

#!/usr/bin/env python3import pygameimport sysred = (255,0,0)black = (0,0,0)test_box = pygame.Rect(10, 130, 80, 60)pygame.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    screen.fill(black)    pygame.draw.rect(screen, red, test_box, 4)        pygame.display.flip()    pygame.time.Clock().tick(60)pygame.quit()sys.exit()

Statistics: Posted by SurferTim — Sun Oct 27, 2024 6:53 am



Viewing all articles
Browse latest Browse all 3556

Trending Articles