I am trying to learn making a GUI using python. I am trying to use a menu system to then have one of the menu options call a function to update the GUI. However instead of when pressing the menu option the GUI updates the GUI is already calling the function on launch.
Heres is my current code.
import tkinter as tk
from tkinter import *
root = tk.Tk()
def db_insert():
Label(root,text='Item Name: ').grid(row=0)
Label(root,text='Item Cost: ').grid(row=1)
Label(root,text='Item Quantity: ').grid(row=2)
e1 = Entry(root)
e2 = Entry(root)
e3 = Entry(root)
e1.grid(row=0,column=1)
e2.grid(row=1,column=1)
e3.grid(row=2,column=1)
menu = Menu(root)
root.config(menu=menu)
filemenu = Menu(menu)
menu.add_cascade(label='File',menu=filemenu)
filemenu.add_command(label='Insert',command=db_insert())
filemenu.add_separator()
filemenu.add_command(label='Exit',command=root.quit)
root.mainloop()