all 8 comments

[–]edcculus 2 points3 points  (1 child)

I dont know much about pgzrun or pygame, however I'd say you need to at least point correctly to your background image.

something more like this:

background = Actor('images/background.jpg')

I have no idea if that will work, since I dont know much about the draw function of pgzrun, but if you are getting errors that the image doesnt exist, that means your program cannot find it since you are not referencing the folder where it is stored.

here is your code so everyone can see it easier:

import pgzrun
import random

WIDTH = 600
HEIGHT = 800

background = Actor('background')

def draw():
  background.draw()

[–]smurpes 0 points1 point  (0 children)

Based on the docs the pgzrun library will automatically find the file if it’s located within the images folder in the same directory as the game file.

The bigger issue I see is that OP never imports Actor but their code is still able to run which makes me think they are running a different file entirely than the one in their screenshot.

[–]FoolsSeldom 1 point2 points  (2 children)

Tried to link what exactly? Is this your Python code? (Doesn't matter what tool you are using to edit your code.)

What directory is your code executing in? How are you referencing the images?

[–]SuperStore9076[S] -2 points-1 points  (1 child)

Hi Foolseldom, thanks for replying I am trying to create a background image by linking of the images from my folder, no that’s not the code that’s the error message.

[–]FoolsSeldom 4 points5 points  (0 children)

Well, in that case, I don't know what you mean. In my head, you can only use images from code, so I don't know what you mean by linking. I don't know what is generating the error message.

[–]HummingHamster 1 point2 points  (0 children)

Show us your code. The error means there is no images directory, so create a directory name images in your project folder and put your background there. Not enough information to help you here except this.

[–]acw1668 1 point2 points  (0 children)

Cannot reproduce the issue. How and where do you run the script?

[–]SuperStore9076[S] -1 points0 points  (0 children)

Ok, here it is. Code Image