I have encountered a wall while using customtkinter and threading together

52 views Asked by At

So the thing is that I have to run a for loop and it takes some time to run, so I made a loading screen in a frame in customtkinter for my app. It goes like this-

import customtkinter
from PIL import Image
from tkinter import PhotoImage
import threading


app = customtkinter.CTk(fg_color="black")
app.geometry("600x600")


#components for loading were here


#animation function
def animestrt():
    loader.place(relx=0.2375, rely=0.15)
    Loading.place(relx=0.09, rely=0.8)
    lol.place(relx=0.09, rely=0.86)
    animation(count)
    app.mainloop()



diff_itags = [#somethings_to_run_through]
results = []


#function that take time and will happen behind loader
def func():
    for itagg in diff_itags:
    print(results)
    print("done")
    


process = threading.Thread(name="process",target=func)

process.start()

while process.is_alive():
    animestrt()

and when I run this code the app doesnt stop after the execution of the main function. I have tried destroying and all but it doesnt work...

could you tell me some solutions to atleast clear the app window after the process is finished so that the main app components could come next?

0

There are 0 answers