Python Forum
[PyGame] Loading a image - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Game Development (https://python-forum.io/forum-11.html)
+--- Thread: [PyGame] Loading a image (/thread-20579.html)



Loading a image - Help_me_Please - Aug-20-2019

I know this should be a simple one but when I run my code I get a blank screen before my game starts, the blank screen should load a loading screen I created in paint. This is saved in the same folder as my game and this title_page() is called after pygame is initialized. width and height are already defined variables that are the height and width of the pygame window. Can I please have some help loading in this image, pygame and time are already imported.

def title_page(width, height):
    screen = pygame.display.set_mode((width, height))
    title_screen = pygame.image.load('4 in a row.png')
    screen.blit(title_screen,(100,100))
    time.sleep(5)
Thanks for the help.


RE: Loading a image - Windspar - Aug-20-2019

Example in getting started.
1. You should only have one main surface.
2. Next time. Use pygame time delay.
3. You forgot to pygame flip or pygame update before it went to sleep. This render main surface to screen.


RE: Loading a image - Help_me_Please - Aug-20-2019

Thanks sorted