Tkinter (the GUI library used in your code) is not thread-safe, which means only the main thread (the one that created the GUI) should update GUI elements like labels or text boxes.