Reputation: 1
I managed to install Pygame but I think I messed something up because when I just try to do :
import pygame
from pygame.locals import *
pygame.init()
fenetre = pygame.display.set_mode((800,533), RESIZABLE)
fond = pygame.image.load("img/Ciel_bleu.jpg").convert()
fenetre.blit(fond, (0,0))
pygame.display.flip()
It says :
error: File is not a Windows BMP file
I am very sorry to bother you with that problem but I really tried for weeks to search for a solution and I don't know what to do... I looked up a lot of posts talking about this error but I can't solve it.. By the way I'm on Mac os x 10.11.4 and I used Anaconda to install Python 2.7.10. Here is the results when I run the "python run_tests.py" file from the Pygame source code folder.
I would be very glad and grateful if someone could help me. Many thanks in advance for your help, have a great day !
(excuse my English)
Upvotes: 0
Views: 3218
Reputation: 51
My solution is updated pygame https://conda.binstar.org/quasiben to https://conda.binstar.org/CogSci.
Once done, import pygame should work.
Upvotes: 1
Reputation: 3043
Give this a try:
Install binstar:
conda install binstar
You get a response like: The 'binstar' conda package has been renamed to 'anaconda-client'. Please run: conda install anaconda-client. So run:
conda install anaconda-client
Then search for the pygame package on anaconda.org:
anaconda search -t conda pygame
You get a list of pygame packages available at anaconda.org. Select a package for your distribution e.g. tlatorre/pygame is for Linux 64-bit. To install it use:
conda install -c https://conda.binstar.org/tlatorre pygame
Once done, import pygame should work.
Credit: Answer by cohdez on Installing pygame module in anaconda mac
Upvotes: 1
Reputation: 3224
As per pygame.org/docs/ref/image.html, "By default it can only load uncompressed BMP images. When built with full image support, the pygame.image.load() function can support the following formats. JPG PNG GIF (non animated) BMP PCX TGA (uncompressed) TIF LBM (and PBM) PBM (and PGM, PPM) XPM".
As per Build Pygame with full image support?, you can get the image module here: http://www.pythonware.com/products/pil
Upvotes: 1