Jump to content
  • Advertisement
Sign in to follow this  
boolean010

Loading a bitmap using pygame

This topic is 3633 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts


import pygame

pygame.init()
screen = pygame.display.set_mode( (640, 480) )
andre = pygame.image.load('andre16.bmp')
screen.blit( andre, (0,0) )

input("Press enter to continue..")
pygame.quit()



I am trying to load a bitmap using pygame. The code shown above is what I tried. It is suppose to blit the bitmap to the screen, but I get nothing. Can someone tell me what I'm doing wrong. Thanks in advance, Glen.

Share this post


Link to post
Share on other sites
Advertisement
After you draw a frame, call pygame.display.flip(). Pygame uses double-buffering, so you're drawing your images to one surface, while another surface is visible on-screen. After you're done, you flip the two, so the latest stuff becomes visible on-screen. Without double-buffering, you could be drawing an image to the screen while the screen is refreshing, which often leads to tearing effects.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!