0

I want to set my Canvas background as gif. Here's what I'm currently trying to do:

def convertPage():
    for i in mw.winfo_children():
        i.destroy()    
    drop_file = Canvas(mw, width=270, height=270)
    drop_file.place(x=25, y=25)
    image = ImageTk.PhotoImage(file="media/ukral.gif")
    drop_file.create_image(10, 10, image=image, anchor=NW)
    Button(mw, text='KEYWORD IMAGE', command=fileDialog, font=('Inter', 24), fg='#3EC96D', bg='black').place(width=250, height=60, relx=0.1875, rely=0.628)
    Button(mw, text='BACK', command=mainPage, font=fnt_sml, fg='#3EC96D', bg='black').place(width=250, height=60, relx=0.1875, rely=0.806)

There are no errors returned in the console, but gif doesn't work, the background of Canvas is white. BTW, I'm doing it from Mac, so maybe this could be the issue.

Update: finally found the solution here:

Play an Animated GIF in python with tkinter

bonbon
  • 5
  • 3

1 Answers1

0

Have you tried to look online?

I found this link, it might be helpful

In short, the answer could be adding the right format kwarg

Eilonlif
  • 346
  • 2
  • 7
  • Yes I tried looking online and the link didn't help. The gif doesn't play – bonbon Apr 07 '22 at 13:50
  • Do you see the gif and it doesn't play or the gif doesn't show at all? – Eilonlif Apr 07 '22 at 14:49
  • So I tried few ways how to do that. In some cases the gif is shown but it doesn't play, in other cases gif just doesn't show up in my canvas. As I already wrote in my question, maybe it's because I'm using Mac? – bonbon Apr 09 '22 at 09:51