I am trying to add a thread to tkinter button to trigger when its presses. but as soon as I run the program, the function inside the button starts automatically before I click anything.
Here is my code:
m = Main()
root = Tk()
root.geometry("500x500")
frame = Frame(root)
frame.pack()
start = Button(frame, text="Start",
command=threading.Thread(target=m.main).start())
stop = Button(frame, text="stop", command=quit)
start.pack(pady=20)
stop.pack()
root.mainloop()