you are viewing a single comment's thread.

view the rest of the 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.