'why is the picture not displayed on the pygame window? the code does not give errors
import pygame
import sys
from pygame.locals import *
import random
import time
GREY = pygame.Color(128, 128, 128)
RED = pygame.Color(255, 0, 0)
BLUE = pygame.Color(0, 0, 255)
GREEN = pygame.Color(0, 255, 0)
BLACK = pygame.Color(0, 0, 0)
WHITE = pygame.Color(255, 255, 255)
PINK = pygame.Color(255, 192, 203)
FPS = 60
FramePerSec = pygame.time.Clock()
screen = pygame.display.set_mode((1024, 526))
screen.fill(GREY)
to_up = False
to_down = False
speed_gg_up = 132
speed_gg_down= 56
gg = pygame.image.load('gg.png')
gg_x = 56
gg_y = 264
while True:
for event in pygame.event.get():
if event.type == pygame.KEYDOWN:
if event.key== pygame.K_UP:
to_up = True
if event.key == pygame.K_DOWN:
to_down = True
if event.type == QUIT:
pygame.quit()
sys.exit()
FramePerSec.tick(FPS)
if to_up:
gg_y -= speed_gg_up
time.sleep(2)
gg_y += speed_gg_up
to_up = False
if to_down:
gg_y +=speed_gg_down
time.sleep(2)
gg_y -= speed_gg_down
to_down = False
screen.blit(gg, (gg_x, gg_y))
pygame.display.update()
the code works without errors, but gives only an empty window. no matter how much I change the code, nothing changes please help me find and fix the error so that the code starts showing the image
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
