0

Hi cannot get images to load any help would be gratefully recieved...

import pygame
import sys
from pygame.locals import *


sys.path.append ("C:\\Python26\Bits\player.png")
###Will not Load saved image
#triedC:\Python26\Bits\player.png
# and tried C:\Python26\Bits
#confusing or what!!!

#Whole program not here



# set up the window
WINDOWWIDTH = 400
WINDOWHEIGHT = 400
windowSurface = pygame.display.set_mode((WINDOWWIDTH, WINDOWHEIGHT), 0, 32)
pygame.display.set_caption('Sprites and Sound')

player = pygame.Rect(300, 100, 40, 40)
playerImage = pygame.image.load('player.png')
playerStretchedImage = pygame.transform.scale(playerImage, (40, 40))

windowSurface.blit(playerStretchedImage, player)

pygame.display.update()


while True:
   # check for the QUIT event
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by richieking
0

pygame.image.load('player.png')

Give the fullpath to the image file ok ?

pygame.image.load('fullimagepath')

Then forget about the sys.path.append() stuff.

image is not a module.
;)

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.