Skip to content
← Back to Community
how to run a .gif
Profile icon
CholsreaMMOS

I'm trying to run a gif to my python program, but I've searched everywhere and cant find out how to do it.

Answered by 19wintersp [earned 5 cycles]
View Answer
Voters
Profile icon
Ahmed-Yasir-You
Profile icon
BrandonMiddleto
Profile icon
SandijaRumba
Profile icon
AlexanderSermos
Profile icon
AlejandroTavell
Profile icon
alexisr2401
Profile icon
MatthewMcAulay1
Profile icon
KristalHanson
Profile icon
MoizSheikh6969
Profile icon
Maciej1234
Comments
hotnewtop
Profile icon
19wintersp

run a gif

What do you mean? You can't "run" an image.

Profile icon
CholsreaMMOS

@19wintersp i meant try to get it to visualize

Profile icon
19wintersp

@CholsreaMMOS You can use the bash command xdg-open:

import os os.system("xdg-open wave.gif")

It's the equivalent of running explorer wave.gif if you're on Windows; it opens the file in the default application for that filetype.
More information

Profile icon
CholsreaMMOS

@19wintersp is there another form of that. i tried but it didn't run the gif it only showed the first frame

Profile icon
19wintersp

@CholsreaMMOS Oh dear, I don't think feh (the default image viewer) animates them. Sorry, I don't know of another way, though you might find this useful.

Profile icon
CholsreaMMOS

@19wintersp ok thanks any way. it looks like it won't work on repl because it requires you to download packages and import them into python. but again, thanks

Profile icon
RYANTADIPARTHI

Solution

You can't run an image, or a gif in the console. python doesn't support that. but flask and django do, they are just web frameworks of python. but the python console doesn't support images or gifs.

Profile icon
CholsreaMMOS

@RYANTADIPARTHI ok ill try it, how do i get to them, just google it them?

A possible alternative is a .gif to a "website link" but couldn't find any ot figure out how to add a link in terminal

Profile icon
RYANTADIPARTHI

@CholsreaMMOS what do you mean by get to them? like i said, python console doesn't support it.

Profile icon
CholsreaMMOS

@RYANTADIPARTHI get to flask or django

Profile icon
RYANTADIPARTHI

@CholsreaMMOS flask and django are programming languages.

Profile icon
19wintersp

@RYANTADIPARTHI What? Flask and Django are frameworks which run on Python, not languages themselves.

Profile icon
RYANTADIPARTHI

@19wintersp if you refer to my first comment. you would get the same exact information of what you said.

Profile icon
19wintersp

@RYANTADIPARTHI Yes, what you said at the start is correct, but that contradicts what you said later:

flask and django are programming languages

Never mind

Profile icon
CholsreaMMOS

i managed to find a website to use to get a link that i can add to the code, thanks for all of your help!

Profile icon
[deleted]

A gif is an image file, not a Python script.

Profile icon
CholsreaMMOS

@LucasAllori yeah i know. Thought it might be displayable in console

Profile icon
[deleted]

@CholsreaMMOS It is not displayable in a console.

Profile icon
CholsreaMMOS

@LucasAllori ok thanks for thee help

Profile icon
[deleted]

@CholsreaMMOS np i guess