Home>
from tkinter import *
import time
import os
root= Tk ()
frameCnt0= 12
frames= [PhotoImage (file= 'C: \\ Python \\ 1.gif', format= 'gif -index% i'% (i)) for i in range (frameCnt0)]
def update (ind):
    frame= frames [ind]
    ind += 1
    if ind== frameCnt0:
        ind= 0
    label.configure (image= frame)
    root.after (100, update, ind)
label= Label (root)
label.pack ()
root.after (0, update, 0)
root.mainloop ()
root1= Tk ()
frameCnt1= 12
frames= [PhotoImage (file= 'C: \\ Python \\ 2.gif', format= 'gif -index% i'% (i)) for i in range (frameCnt1)]
def update (ind):
    frame= frames [ind]
    ind += 1
    if ind== frameCnt1:
        ind= 0
    label.configure (image= frame)
    root1.after (100, update, ind)
label= Label (root1)
label.pack ()
root1.after (0, update, 0)
root1.mainloop ()
root2= Tk ()
frameCnt2= 12
frames= [PhotoImage (file= 'C: \\ Python \\ 3.gif', format= 'gif -index% i'% (i)) for i in range (frameCnt2)]
def update (ind):
    frame= frames [ind]
    ind += 1
    if ind== frameCnt2:
        ind= 0
    label.configure (image= frame)
    root2.after (100, update, ind)
label= Label (root2)
label.pack ()
root2.after (0, update, 0)
root2.mainloop ()

outputs to the console

invalid command name "17167785update
While executing
("after script")
# invalid command name "26373832 update
While executing
26373832update
("after script")

Why do you instantiate Tk three times and run mainloop three times and terminate it? Tkinter programs don't do this more than once. But if for some reason this is necessary, then cancel all scheduled after before exiting mainloop.

GrAnd2021-12-30 08:22:00

There must be one Tk object. If you need to close /open several windows, hide the initial Tk window, make windows through Toplevel

insolor2021-12-30 09:28:24

Thanks more, fixed everything)))

d1ma_sta2021-12-30 09:39:33