0

I've had this problem for a while. When I start a program, any tkinter buttons will call their functions without being pressed or anything. and after that, I cannot use the button anymore because it only works once for some reason. Can anybody help?

This is not the actual code, but it is an example:

from tkinter import *

root = Tk()

def function():
    print("activated")

button = Button(root, text="this is a button", command=function)
button.pack()

root.mainloop()
Spiceinajar
  • 101
  • 1
  • 10
  • 1
    the example provided works as expected (no auto-calling the functions), for me at least. I assume the problem lies somewhere else – Mario Feb 08 '22 at 18:39
  • 6
    Your actual code probably has `command=function()`, which is indeed an immediate call of the function. – jasonharper Feb 08 '22 at 18:44

0 Answers0