I have this image and I want to make the width of this image longer till the end of the window of tkinter using animation but I haven't got any proper way to achieving this task. any suggestions ?
I have this image and I want to make the width of this image longer till the end of the window of tkinter using animation but I haven't got any proper way to achieving this task. any suggestions ?
Solution with PIL
:
import tkinter as tk
from PIL import Image, ImageTkdef work(progress=1):if progress > 300: # define the width by yourselfreturntmp_images = ImageTk.PhotoImage(progress_images.resize((progress, 10))) # the image sizelb.image = tmp_images # keep referencelb["image"] = tmp_images # change the imageroot.add = root.after(100, work, progress+10) # define the amplitude by yourselfroot = tk.Tk()progress_images = Image.open("path.png")
lb = tk.Label(root, bg="black")
lb.pack(side="left")
work()root.mainloop()
Animation: