python - pygame.error Unsupported image format -
running python 3.3.0 pygame '1.9.2pre', following tutorial, new python, cant see i've gone wrong, looks same on tutorial, 4 years old. help!
i error - unsupported image format both. i've tried jpg , png, version spec says supports them both.
bif ="bg.jpg" mif ="man.jpg" import pygame, sys pygame.locals import * pygame.init() screen = pygame.display.set_mode((1100,750),0,32) background = pygame.image.load(bif).convert() mouse_c = pygame.image.load(mif).convert_alpha() running = true while running: event in pygame.event.get(): if event.type == quit: pygame.quit() running = false sys.exit() break screen.blit(background,(0,0)) x,y = pygame.mouse.get_pos() x -= mouse_r.get_width()/2 y -= mouse_r.get_height()/2 screen.blit(mouse_r,(x,y)) pygame.display.update()
i assume pygame window not shutting due error in code. can exit python shell exit pygame window, error main issue here.
if you're importing images so, make sure images in same folder or location .py file don't understand got mouse_r out of.
try this:
import pygame, sys pygame.locals import * pygame.init() screen = pygame.display.set_mode((1100,750),0,32) background = pygame.image.load("bg.jpg").convert() mouse_c = pygame.image.load("man.jpg").convert_alpha() running = true while running: event in pygame.event.get(): if event.type == quit: pygame.quit() running = false sys.exit() break screen.blit(background,(0,0)) x,y = pygame.mouse.get_pos() x -= screen.get_width()/2 y -= screen.get_height()/2 screen.blit(mouse_c,(x,y)) pygame.display.update()
Comments
Post a Comment