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")
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:24Thanks more, fixed everything)))
d1ma_sta2021-12-30 09:39:33Related questions
- Python Tkinter not seeing 'TimePL' instance of Label widget
- python : How can a scrollbar be attached to a label in tkinter
- python : Why root.attributes('-topmost', False) fires every other time?
- python : How to write functions for buttons to work?
- Working buttons in TKinter in Python in OOP
- python : How to create a large text input field?
- python : How to keep the scale of buttons, text, etc in tkinter?
- python : how to bind keyboard input in Tkinter
- python : how to find out the size of a Tkinter window?
- python : How to make txt to html text converter
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