Skip to content
Sign upLog in
← Back to Community

How do you add images?

Profile icon
WyattKinzer1

so i want to make it so that they search for something and the definition appears with an image as well. I don't know if this is possible. thanks

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
Profile icon
WyattKinzer1
Comments
hotnewtop
Profile icon
Coder100

Not with python, it is possible with tkinter read more here

Profile icon
WyattKinzer1

that sucks, it would be really cool to be able to in [email protected]

Profile icon
Coder100
Profile icon
Coder100

I mean there's ASCII art too...

@WyattKinzer1

Profile icon
WyattKinzer1

whats that?


@Coder100

Profile icon
Coder100
Profile icon
WyattKinzer1

( ͡👁️ ͜ʖ ͡👁️) this is [email protected]

Profile icon
Coder100

indeed very easy to get lost in it's many features!!

@WyattKinzer1

Profile icon
UniqueOstrich18

You can put an image into the terminal using a program called TerminalImageViewer.

Insert this into the beginning of your code:

import os os.system("wget https://raw.githubusercontent.com/stefanhaustein/TerminalImageViewer/master/src/main/java/TerminalImageViewer.java -q -O TerminalImageViewer.java") file = open("TerminalImageViewer.java") lines = file.readlines() lines[35] = ' " - When multiple files are supplied, -c sets the number of images per row (default: 4)." + ' file = open("TerminalImageViewer.java","w") file.writelines(lines) file.close() os.system("javac TerminalImageViewer.java") os.system("clear")

This will download the program, fix a typo, and compile it.

To view an image, run:

os.system("java TerminalImageViewer [image]")

Replace [image] with the filename of the image you want to open.

Example:
image

Its not the highest resolution, but at least you can see what is in the image.

If you want to test it, go to https://repl.it/@UniqueOstrich18/Terminal-Image-Test#main.py

Btw if you don't want the "starting x" text to appear, download a blank png file from https://commons.wikimedia.org/wiki/File:Blank.png#/media/File:Blank.png, upload it to your repl and put this code after first one:

os.system("java TerminalImageViewer Blank.png") os.system("clear")
Profile icon
RYANTADIPARTHI

Here's an image to help you.

Screenshot 2020-10-27 at 2.15.42 PM

Profile icon
SixBeeps

You can't have images in a console application, but you can put a link to an image that the user can then click to view in a new tab. Just print the image URL and Repl.it will automatically make it into a clickable link.

Profile icon
WyattKinzer1
Profile icon
UniqueOstrich18
Profile icon
SixBeeps

@UniqueOstrich18
Oh god that looks horrific
image

Profile icon
UniqueOstrich18

@SixBeeps
yea but it works

Profile icon
SixBeeps

@UniqueOstrich18
Why didn't you just restrict the resolution and use something like nearest neighbor? Something like https://repl.it/@SixBeeps/ConsoleRGBColor#Main.java

Profile icon
UniqueOstrich18

@SixBeeps
Yea, but this way gives more detail

Profile icon
RYANTADIPARTHI

Two ways to do it, ith right click on an image you want, click copy image, then paste it in here -

Invalid image url
the src. Or put your image in the repl, and put the file name instead in the src.