Solving problem is about exposing yourself to as many situations as possible like Pygame unresponsive display [duplicate] and practice these strategies over and over. With time, it becomes second nature and a natural way you approach any problems in general. Big or small, always start with a plan, use other strategies mentioned here till you are confident and ready to code the solution.
In this post, my aim is to share an overview the topic about Pygame unresponsive display [duplicate], which can be followed any time. Take easy to follow this discuss.
So I am attempting to create the foundation for a basic 2D python game with X and Y movement using a sprite.
However the display is unresposive despite the code here attempting to
playerX = 50 playerY = 50 player = pygame.image.load("player.png") width, height = 64*8, 64*8 screen=pygame.display.set_mode((width, height)) screen.fill((255,255,255)) screen.blit(player, (playerX, playerY))
Am I missing something important?
A minimal, typical PyGame application
has a game loop
For each frame of your game, you will need to make some sort of call to the event queue. This ensures your program can internally interact with the rest of the operating system.
See also Python Pygame Introduction
Minimal example: repl.it/@Rabbid76/PyGame-MinimalApplicationLoop
import pygame pygame.init() playerX = 50 playerY = 50 player = pygame.image.load("player.png") width, height = 64*8, 64*8 screen = pygame.display.set_mode((width, height)) # main application loop run = True while run: # event loop for event in pygame.event.get(): if event.type == pygame.QUIT: run = False # clear the display screen.fill((255,255,255)) # draw the scene screen.blit(player, (playerX, playerY)) # update the display pygame.display.flip()