Why does pygame.display.update() does not update my screen?

I'm writing a primitive game and at the end of the main loop, as expected, refresh the function pygame.display.update(), but the screen is not updated until I start to turn the mouse cursor on the window or not stand part of the window area of the monitor. What's the problem?

the code itself:

from entity import *
from cfg import *

pygame.display.set_caption('runner')

player = player()

clock = pygame.time.Clock()
FPS = 60
clock.tick(FPS)
pygame.init()
pygame.display.set_caption('runner')


def main():
 run = True
 while run:
 for e in pygame.event.get():
 if e.type == pygame.QUIT:
 run = False

 display.fill((100, 100, 100))
player.render()
player.move()
pygame.display.update()


if __name__ == '__main__':
 main()


code file entity.py:

from cfg import *


class player:

 def __init__(self, posX=50, posY=50, size=20, moveSpeed=5, motion='none'):
 self.posX = posX
 self.posY = posY
 self.size = size
 self.moveSpeed = moveSpeed
 self.motion = motion

 def move(self):

 motion = 'none'

 for e in pygame.event.get():
 keys = pygame.key.get_pressed()
 if keys[pygame.K_UP or pygame.K_w]:
 motion = 'up'
 if keys[pygame.K_DOWN or pygame.K_s]:
 motion = 'down'
 if e.type == pygame.KEYUP:
 motion = 'none'

 if motion == 'up':
 if self.posY >= self.size * 2:
 self.posY -= self.moveSpeed
 elif motion == 'down':
 if self.posY <= screenHeight - self.size * 2:
 self.posY += self.moveSpeed

 def render(self):
 pygame.draw.circle(display, (255, 255, 255), (self.posX, self.posY), self.size)


code file cfg.py
import pygame

screenWidth = 600
screenHeight = 300
display = pygame.display.set_mode((screenWidth, screenHeight))
April 8th 20 at 17:55
1 answer
April 8th 20 at 17:57
maybe it should be? don't know what should give pygame.key.get_pressed()
in if keys [pygame.K_UP,pygame.K_w]:
 motion = 'up'
in if keys [pygame.K_DOWN,pygame.K_s]:
pygame.key.get_pressed() gives the status of any key(approx. = "key pressed?")

if keys[pygame.K_UP or pygame.K_w]:
 motion = 'up'


and this construction clarifies that the pressed key is "K_UP" then move up

p.s if you remove :
pygame.key.get_pressed()
then for reasons unknown to me the constant movement while pressing impossible - Lolita commented on April 8th 20 at 18:00

Find more questions by tags pygamePython