image loading
I am trying to get an image to load but it an error come up whenever I try. the error is "pygame.error: Couldn't open data\menu.bmp" This is my code:import pygame, sys
from pygame.locals import *
pygame.init()
Surface = pygame.display.set_mode((600, 450), 0, 32)
menuimage = pygame.image.load("data\\menu.bmp")
menu = pygame.image.load(menuimage)
Surface.blit(menu, (50, 50))
how can I get it to work?
(log in to comment)
ArmchairArmada on 2011/04/03 03:32:
I'm not 100% certain what the problem is, but I can make a few recommendations. I usually use PNG for images; maybe PyGame doesn't like bitmaps? Also I think Skellington has a function to help with file paths; you could try using that.Something I just noticed while looking at your code. You seem to be loading an image into 'menuimage' then trying to use that menuimage surface to load 'menu'. I don't think you meant to do that as menuimage would not be a file path.