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 "Result" window it appears right away without clicking the "btn" button. And why do I need to import 'messagebox' separately even though I have imported all tkinter modules before?