Upload an image to your sandbox editor so you can refer to it in your project.

  1. Go to the Sandbox environment.

  2. Click on the three dots next to Project to see file options.

  3. Click Add >> File (image). Then upload the image from your computer.

4. Then 'Save' to save the image with the project.

<Python example>

To display the image file to the results panel, try entering the following code. Replace 'background.png' with the name of the image file. Then select your run file and run.

import os
import pygame


width = 600
height = 400
screen = pygame.display.set_mode((width, height))

isPlaying = True

# Background
background = pygame.image.load(os.path.join(os.path.dirname(__file__), 'background.png'))

while isPlaying:
screen.blit(background, (0, 0))

for event in pygame.event.get():
if event.type == pygame.QUIT:
isPlaying = False


*If you are trying to see the updated output and are not able to see it, make sure to close the screen window first before running the code.

Did this answer your question?