So after some scrambling around trying to find a good beginner programming language, i have found python, and with my ultimate goal being game development, also pygame.
I have just started learning some basics, and I was going through a tutorial when i ran into an error that im not sure how to get around.
Here is my code:
import pygame, sys,os from pygame.locals import * pygame.init() window = pygame.display.set_mode((640, 320)) pygame.display.set_caption('Test') screen = pygame.display.get_surface() background = os.path.join("C:\\python26\\stuff\\bg.jpeg") background_surface = pygame.image.load(background) screen.blit(background_surface, (0,0)) pygame.display.flip() def input(events): for event in events: if event.type == QUIT: sys.exit(0) else: print event while True: input(pygame.event.get())
I want to load the background image (which is 100% in the directory i specified). Unfortunately when i run the program i recieve the following error:
Traceback (most recent call last): File "C:/Python26/Tutorial", line 12, in <module> background_surface = pygame.image.load(background) error: Couldn't open C:\python26\stuff\bg.jpeg
I have searched some, and found that inputting the os.path.join command was supposed to get rid of the error because of the cross-platform compatibility or somthing.
Currently on vista 64bit, dont know if that helps or not.
All replies appreciated, thank you for taking the time to read and (hopefully) respond.