What is a good way to draw images using pygame?

jtl999 picture jtl999 · Jan 15, 2012 · Viewed 28.1k times · Source

I would like to know how to draw images using pygame. I know how to load them. I have made a blank window. When I use screen.blit(blank, (10,10)), it does not draw the image and instead leaves the screen blank.

Answer

joaquin picture joaquin · Jan 15, 2012

This is a typical layout:

myimage = pygame.image.load("myimage.bmp")
imagerect = myimage.get_rect()

while 1:
    your_code_here

    screen.fill(black)
    screen.blit(myimage, imagerect)
    pygame.display.flip()