Does anybody know how to add a background image in Python?

I was following the next tutorial, and the person says that you can give the background a color. That person did green as color. But i wanted the background as a sahara. Does anyone know how to add the image than in the code? I already have the sahara image and when i saved the sahar image i saw that it has been saved in a PNG file from what i can see.
I wrote the image upload in python like: imp = image.load("def sahara.achtergrond.png") but they say in the error that the word ‘image’ is not defined.
Does anyone know how to fix this? So for the next time i will be able to do it on my own.

import turtle                                
wn = turtle.Screen()                         
wn.title("Falling Skies")                    
imp =image.load("def sahara achtergrond.png")    
wn.setup(width= 800, height= 600)

@amel8star did you try using turtle.addshape() instead of image.load()?

I think the image is not a PNG file, maybe because of that it didnt work. The image that i wanted to upload is like a sahara and i wanted it as a background. Do you think it will work if i a upload it as a PNG file if i want to make it a background in the game?

you should upload it as a gif because turtle.addShape() only takes gifs

It worked. Thank you. I made a other file for it and now i can see the background

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