Ask coding questions

← Back to all posts
How can we display pictures on repl?
WilliamXing (45)

I'm trying to add pictures to one of my games to make it more interesting. How do you do that?

Answered by RYANTADIPARTHI (6001) [earned 5 cycles]
View Answer
Comments
hotnewtop
RYANTADIPARTHI (6001)

Solution

you can do this using HTML. Other languages too, but it's easier with HTML. Use the img tag.

<img src="IMAGEURL">

in the imageurl, put your URL for the image, or upload one, and put the name of it.
That should work

WilliamXing (45)

Do you know how to do it on python?

RYANTADIPARTHI (6001)

@WilliamXing sorry, it's not possible in console python.

robowolf (435)

@WilliamXing Have you tried pygame? You could use it for the sole purpose of showing an image.

WilliamXing (45)

@robowolf How do we do it in pygame?

robowolf (435)

@WilliamXing I'm not an expert in it so I would suggest searching up documentation. It think you can use pygame.display('img.jpg')

WilliamXing (45)

@robowolf What do you mean documentation?

robowolf (435)

@WilliamXing Documentation is like an instruction manual to code. Pygame documentation will tell you every command there is. You can just search in the documentation or online how to display image in pygame.

WilliamXing (45)

@robowolf Can you try searching? I couldn't find anything good.