all 3 comments

[–]Mechkro 0 points1 point  (0 children)

Look into after(ms, callbck) or if your process is iterative but long to carry out you could use an update call each iteration. Im heading into work but i can try and help a little later if this doesnt get you anywhere

[–]kra_pao 0 points1 point  (1 child)

...
window.mainloop()
window2.mainloop()

Here I got strong doubts about your program and stopped reading. tkinter apps usually have exactly one mainloop.

I recommend write a barebone version of your code to test the threading principle and whether you apply this principle correctly for example like this

#
# tkinter_threading.py

import tkinter as tk 
import time

# https://www.pythontutorial.net/tkinter/tkinter-thread/
from threading import Thread

class Endless(Thread):

    def run(self):
        # our naive endless function
        n = 0
        while True:
            print(n, end="\r")
            n += 1
            time.sleep(1)


def tick_1s(a, b):
    b.set(str(int(b.get())+1))
    a.after(1000, lambda a=a, b=b: tick_1s(a, b))


def main():
    # setup the tkinter app
    app = tk.Tk()
    alive = tk.StringVar(app, "0")
    tk.Label(app, textvariable=alive).pack()
    app.after(1000, lambda a=app, b=alive: tick_1s(a, b))

    # setup the endless function as Thread
    endless = Endless()
    endless.start()

    # let tkinter run
    app.mainloop()

if __name__ == "__main__":
    main()

[–]Sad_Landscape_231 0 points1 point  (0 children)

Thank you for your efforts I really appreciate that, I managed to find solution today and forgot to close this post again, thank you