Apr-15-2019, 07:44 PM
hi
hi I am learning pygame please.I am using windows computer.Please I want to upload images from opengameart.org.
I have downloaded them for my game.Please see the error that comes in my pygame.Please help me with this.
Many thanks
The error when I run the code in IDLE shell is as following:
Traceback (most recent call last):
File "C:\Users\ammah\OneDrive\Documents\project1\templae.py", line 84, in <module>
background = pygame.image.load(path.join(img_dir,"ship1.jpg")).convert()
pygame.error: Couldn't open C:\Users\ammah\OneDrive\Documents\project1\ship1.jpg\ship1.jpg
The code that I have written is the following:
import pygame
import random
from os import path
img_dir = path.join(path.dirname(__file__),"ship1.jpg")
#Load all game graphics
background = pygame.image.load(path.join(img_dir,"ship1.jpg")).convert()
background_rect = background.get_rect()
screen.blit(backgound, background_rect)
please help!
hi I am learning pygame please.I am using windows computer.Please I want to upload images from opengameart.org.
I have downloaded them for my game.Please see the error that comes in my pygame.Please help me with this.
Many thanks
The error when I run the code in IDLE shell is as following:
Traceback (most recent call last):
File "C:\Users\ammah\OneDrive\Documents\project1\templae.py", line 84, in <module>
background = pygame.image.load(path.join(img_dir,"ship1.jpg")).convert()
pygame.error: Couldn't open C:\Users\ammah\OneDrive\Documents\project1\ship1.jpg\ship1.jpg
The code that I have written is the following:
import pygame
import random
from os import path
img_dir = path.join(path.dirname(__file__),"ship1.jpg")
#Load all game graphics
background = pygame.image.load(path.join(img_dir,"ship1.jpg")).convert()
background_rect = background.get_rect()
screen.blit(backgound, background_rect)
please help!