I'm making a small script in python with ttk and I have a problem where a function runs where it shouldn't. The button code looks as follows:
btReload = ttk.Button(treeBottomUI, text="Reload", width=17, command=loadModelTree(treeModel)) btReload.pack(side="left")
and the function is as this:
def loadModelTree(tree): print ("Loading models...") allModels = os.listdir(confModPath) for chunk in allModels: ...
For some reason, the function runs without the button being pressed. Why?