I want to display a gif image using Pillow
Here is my simple code:
from tkinter import *
from PIL import Image, ImageTk
import tkinter as Tk
image = Image.open("Puissance4.gif")
image.show()
But nothing happens...
All help will be appreciated
Thanks!
PIL provides a
show
method which attempts to detect your OS and choose an appropriate viewer. On Unix it tries calling the imagemagick commanddisplay
orxv
. On Macs it usesopen
, on Windows it uses... something else.If it can't find an appropriate viewer,
ImageShow._viewers
will be an empty list.On Raspbian, you'll need to install an image viewer such as
display
,xv
orfim
. (Note a search on the web will show that there are many image viewers available.) Then you can tell PIL to use it by specifying thecommand
parameter:To display an image in Tkinter, you could use something like: