How do I use imported images in the CMU Graphics template?

I’m storing image links in an array because I used them later on in my program, but they throw an error when used. I tried downloading the images and using the file source into the img src property but it also threw an error. Can you even use images at all in the template?
Repl link:

You have to change the main image store for this to work.


Change to your local files:

MainImageStorage = [

The same thing when you are referencing the source for the initial image load

#Character Pic
AnimatedFrame= Star(200,150,90,40)
AnimatedSpikes= Star(200,150,90,20)
AnimatedImageBorder= Circle(200,150,80)

You change the app.image to:

app.image = Image(MainImageStorage[0], 130, 80)

MainImageStorage[0] references the first element in the MainImageStorage array, which, after we updated the array paths, now points to the local file path images/cleo.png.


I’ll try that. Thanks!

It works! That was helpful.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.