Advertisement
Guest User

blitting PngImageFile into pygame.surface

a guest
Feb 20th, 2014
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. import pygame
  2. from PIL import Image
  3.  
  4. sprites = Image.open('sprites.data')
  5. pygameImage = pygame.image.fromstring(sprites.tostring(), (760, 166), 'RGB', False)
  6.  
  7. background = pygame.Surface((800, 600))
  8. rect = pygame.Rect((0, 0, 150, 200))
  9. background.blit(pygameImage, (0, 0), rect)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement