This is my code:
import pygame
# Initialize
pygame.init()
screenInfo = pygame.display.Info()
displayWidth = screenInfo.current_w # 1920 on my pc
displayHeight = screenInfo.current_h # 1080 on my pc
gameDisplay = pygame.display.set_mode((displayWidth, displayHeight), pygame.FULLSCREEN)
quit_game = False
def HandleEvents():
"""
Handle quit requests from user
"""
global quit_game
for event in pygame.event.get():
if event.type == pygame.QUIT or (event.type == pygame.KEYDOWN and event.key == pygame.K_q):
quit_game = True
while not quit_game:
HandleEvents()
gameDisplay.fill((0, 0, 0))
pygame.draw.circle(gameDisplay, (255, 255, 255), (displayWidth/2, displayHeight/2), 20)
pygame.display.update()
When I run it, the white circle appears in the middle of the screen as intended, but when I switch to another window by pressing alt+esc and then re-enter the program by pressing on it's icon the white circle moves to the right and stays that way no matter how much I re-enter the program again.