Created
October 31, 2015 11:49
-
-
Save stamaniorec/247bd63fee23d08ac266 to your computer and use it in GitHub Desktop.
#pygame load and draw image
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import os, sys | |
| def load_image(name): | |
| fullname = os.path.join('data', name) | |
| try: | |
| image = pygame.image.load(fullname) | |
| except pygame.error, message: | |
| print 'Cannot load image:', name | |
| raise SystemExit, message | |
| image = image.convert() | |
| return image | |
| image = load_image('image.jpg') | |
| image = pygame.transform.scale(image, (desired_width,desired_height)) | |
| game_display.blit(image, (dest_x,dest_y)) | |
| pygame.display.update() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment