If I run this , it will run the command without pressing the button. And I know I can change variable a to "hi" on the second line, but I cant on another piece of code that I am working on (I made this one to be a lot simpler and easier to explain(not because you wouldn't understand))
I have tried changing what is in between the brackets on the 4th line, that didn't help.
from tkinter import *
from tkinter import messagebox
top = Tk()
top.geometry("100x100")
def helloCallBack(a):
msg = messagebox.showinfo( "Hello Python", a)
B = Button(top, text = "Hello", command = helloCallBack("hi"))
B.place(x = 50,y = 50)
top.mainloop()
I was hoping, that as soon as the button was pressed, not before, the message box would appear and show "Python hi".