mhaggard25
November 5th, 2013, 06:17 AM
I am learning python 3 and pygame, and I have a problem with one of my computers. I am trying to load in some images in pygame, but for some reason I can only load in windows bitmap files (.bmp). The computer is running Ubuntu 13.04 (idk if that matters or not). My Python version is 3.3.1 and Pygame version is 1.9.2. I have this exact same setup on my laptop (which is quite a bit newer and runs Linux Mint 15) and it has no problems at all with the file types of the images... Any help is appreciated. Thank you in advance.
Here is my code:
import pygame, sys
from pygame.locals import *
pygame.init()
bif = "background.bmp" # anytime working with alot of colors, make it a .jpg
mif = "baseball.png" # anytime working with tansparency, make it a .png
screen = pygame.display.set_mode((800, 400), 0, 32)
background = pygame.image.load(bif).convert()
mouse_c = pygame.image.load(mif).convert_alpha()
while True:
for event in pygame.event.get():
if event.type == QUIT:
sys.exit()
screen.blit(background, (0, 0))
x, y = pygame.mouse.get_pos()
x -= mouse_c.get_width()/2
y -= mouse_c.get_height()/2
screen.blit(mouse_c, (x, y))
pygame.display.update()
Here is the error I get:
mouse_c = pygame.image.load(mif).convert_alpha()
pygame.error: File is not a Windows BMP file
Here is my code:
import pygame, sys
from pygame.locals import *
pygame.init()
bif = "background.bmp" # anytime working with alot of colors, make it a .jpg
mif = "baseball.png" # anytime working with tansparency, make it a .png
screen = pygame.display.set_mode((800, 400), 0, 32)
background = pygame.image.load(bif).convert()
mouse_c = pygame.image.load(mif).convert_alpha()
while True:
for event in pygame.event.get():
if event.type == QUIT:
sys.exit()
screen.blit(background, (0, 0))
x, y = pygame.mouse.get_pos()
x -= mouse_c.get_width()/2
y -= mouse_c.get_height()/2
screen.blit(mouse_c, (x, y))
pygame.display.update()
Here is the error I get:
mouse_c = pygame.image.load(mif).convert_alpha()
pygame.error: File is not a Windows BMP file