Unraring alot of .rar files problem

So ive got it to work, a derectory with 20-30 different rar archives but when it starts I cant get it to do anything else while its finished the entire directory. Heres my code:

    for file in files:
        if file.endswith('.part01.rar'):
            file_count += 1
            label7 = CTkLabel(master=app, text="Extracted Files: " + str(file_count) + "               ")
            label7.place(relx=0.2, rely=0.8)
            rar_file=my_sdirectory+"/"+file
            patoolib.extract_archive(rar_file, outdir=my_destination)

i want it to display the file count ( which it doesnt show untill finished ) and also to delete the sourse .rars before extracting the next rar file. Any help appreciated :slight_smile:

In general, long-running tasks don’t do well in GUI threads. I would recommend looking into dividing the program into two parts: one part ONLY handles the GUI, and its sole job is to keep the user up-to-date on where things are at; the other part does the unrarring and periodically (maybe after each archive is dealt with) sends a message to the GUI thread to say “hey, here’s where we’re up to”.

2 Likes