How to display Images in Pygame?
In previous post, we created an empty window for our game. In this post, let's add some images to our window.
In Pygame, Images are represented by a pygame object called as "surface". The Surface has a fixed resolution and pixel format
In Pygame, Images are represented by a pygame object called as "surface". The Surface has a fixed resolution and pixel format
In previous post, when we wrote a code that gave us an empty window which was looking like this.
Now we want to show some real picture on this window let's say something looking like this
for this we need to use two pygame modules those are pygame.surface and pygame.image
there is a method called pygame.image.load() which is used to load images and a blit() function of surface object to show one image on top of another.
please checkout following source code link that will give you a step by step guide to get your window displayed as
and yeah,we got how to display images on our empty game window that we created in previous post .
Get the source code Here!
Now we want to show some real picture on this window let's say something looking like this
for this we need to use two pygame modules those are pygame.surface and pygame.image
there is a method called pygame.image.load() which is used to load images and a blit() function of surface object to show one image on top of another.
please checkout following source code link that will give you a step by step guide to get your window displayed as
and yeah,we got how to display images on our empty game window that we created in previous post .
Get the source code Here!