0
Here is my code:
from tkinter import *
from tkinter import messagebox
def add(a, b):
messagebox.showinfo("Resultado", a.get()+b.get())
win=Tk()
win.geometry('300x200')
a=StringVar()
b=StringVar()
in1=Entry(win, textvariable=a)
in2=Entry(win, textvariable=b)
btn=Button(win, text="Somar", activebackground='green', command=add(a,b))
in1.pack()
in2.pack()
btn.pack()
win.mainloop()
When I run the window "Result" appears soon even though I did not click on the button "btn". And why I need to import 'messagebox' separately even though I have imported every Tkinter module before?