0

I am trying to run run() which contains a while True: block. I run mainloop() but only that function runs but not the windows even though it's threaded.

def run():
    
    while True:
        ...


master = tk.Tk()

master.geometry("300x200")
master.title("Speech helper")
button = tk.Button(master,text="OFF",bg="#FF0000",command=lambda:flip())
button.pack()

t = threading.Thread(target=run)
t.start()
t.join()


master.mainloop()

What can I do to run them both?

martineau
  • 112,593
  • 23
  • 157
  • 280
Guy zvi
  • 65
  • 1
  • 6
  • 1
    `t.join()` means "Wait for this thread to finish". So if the thread has an ongoing loop, execution never gets past this line. – Johnny Mopp Feb 23 '22 at 19:19

0 Answers0