title: How to add mathematical functionality in my tkinter program for online restaurant menu and ordering system?
body: <p>We have made a program on tkinter for a pizzeria where we can place and customize out order. What I would like to add in this is the functionality. I would like the program to automatically create a total of all the choices selected by the user and display the total in the billing section(which will be created in the down right corner).</p>
  <p>Please tell me and explain to me a way through which I can do that.</p>
  <p>Here is my code:</p>
  <pre><code>from tkinter import *
  
  win = Tk()
  var = IntVar()
  win.title(&quot;Pizzeria&quot;)
  win.geometry(&quot;1400x1400&quot;)
  win.configure(bg=&quot;grey&quot;)
  
  label = Label(win, text=&quot;Athena's Pizzeria&quot;, font=(&quot;Helvectica&quot;, 35), bg=&quot;grey&quot;, fg=&quot;yellow&quot;)
  label.grid(row=0, column=0, columnspan=4, padx=30, pady=20)
  
  label10 = Label(win, text=&quot;Choose the size of your pizza&quot;, font=(&quot;Minison Pro Cond&quot;, 20), bg=&quot;black&quot;, fg=&quot;White&quot;)
  label10.grid(row=1, column=0, ipadx=20, ipady=10, padx=10, pady=10)
  
  label2 = Label(win, text=&quot;Choose your Crust&quot;, font=(&quot;Minion Pro Cond&quot;, 20), bg=&quot;black&quot;, fg=&quot;White&quot;)
  label2.grid(sticky=&quot;w&quot;, row=6, column=0, ipadx=20, ipady=10, padx=10)
  
  label3 = Label(win, text=&quot;Choose your Flavour&quot;, font=(&quot;Minion Pro Cond&quot;, 20), bg=&quot;black&quot;, fg=&quot;White&quot;)
  label3.grid(sticky=&quot;w&quot;, row=1, column=3, ipadx=20, ipady=10, padx=10, pady=10)
  
  label2 = Label(win, text=&quot;Choose your Topping&quot;, font=(&quot;Minion Pro Cond&quot;, 20), bg=&quot;black&quot;, fg=&quot;white&quot;)
  label2.grid(row=1, column=4, ipadx=20, ipady=10, padx=10, pady=10)
  
  label3 = Label(win, text=&quot;Choose your sauce&quot;, font=(&quot;Minion Pro Cond&quot;, 20), bg=&quot;black&quot;, fg=&quot;white&quot;)
  label3.grid(row=1, column=5, ipadx=20, ipady=10, padx=10, pady=10, sticky=&quot;w&quot;)
  
  label4 = Label(win, text=&quot;Choose your drink&quot;, font=(&quot;Minion Pro Cond&quot;, 20), bg=&quot;black&quot;, fg=&quot;white&quot;)
  label4.grid(row=6, column=5, ipadx=20, ipady=10, padx=10, pady=10, sticky=&quot;w&quot;)
  
  u_list = []
  ## you can also do grid inside pack frame unlike other scenarios
  
  r = IntVar()
  r.set(2)
  flavours = [&quot;Sicilian Tikka&quot;, &quot;Morrocon Fajita&quot;, &quot;Buffalo Ranch&quot;, &quot;Margherita&quot;, &quot;Habenero&quot;, &quot;All Cheese&quot;, &quot;All Veggie&quot;,
              &quot;Supereme Max&quot;]
  flavour = StringVar()
  flavour.set(&quot;Sicilian Tikka&quot;)
  
  
  def nextt():
      global u_list
      u_list = u_list[-1:]
      print(u_list)
  
  
  def click(value):
      u_list.append(value)
  
  
  for i in range(len(flavours)):
      Radiobutton(win, text=flavours[i], variable=flavour, width=12, height=3, bg=&quot;green&quot;, value=flavours[i],
                  activebackground=&quot;red&quot;, anchor=W, command=lambda: click(flavour.get())).grid(row=i + 2, column=3,
                                                                                               padx=10, pady=10,
                                                                                               sticky=&quot;w&quot;)
  
  v_list = []
  ## you can also do grid inside pack frame unlike other scenarios
  
  r = IntVar()
  r.set(2)
  sizes = [&quot;Small&quot;, &quot;Medium&quot;, &quot;Large&quot;, &quot;20'slice&quot;]
  size = StringVar()
  size.set(&quot;Small&quot;)
  
  
  def nextt():
      global v_list
      v_list = v_list[-1:]
      print(v_list)
  
  
  def click(value):
      v_list.append(value)
  
  
  for i in range(len(sizes)):
      Radiobutton(win, text=sizes[i], variable=size, width=10, height=3, bg=&quot;green&quot;, value=sizes[i],
                  activebackground=&quot;red&quot;, anchor=W, command=lambda: click(size.get())).grid(row=i + 2, column=0, padx=10,
                                                                                            pady=10, sticky=&quot;w&quot;)
  
  m_list = []
  ## you can also do grid inside pack frame unlike other scenarios
  
  r = IntVar()
  r.set(2)
  toppings = [&quot;Olives&quot;, &quot;Halepenos&quot;, &quot;Red Pepper&quot;, &quot;Pepperoni&quot;, &quot;Mushrooms&quot;, &quot;Tomatoes&quot;, &quot;Chilli&quot;, &quot;Capsicum&quot;]
  topping = StringVar()
  topping.set(&quot;Olives&quot;)
  
  
  def nextt():
      global m_list
      m_list = m_list[-1:]
      print(m_list)
  
  
  def click(value):
      m_list.append(value)
  
  
  for i in range(len(toppings)):
      Radiobutton(win, text=toppings[i], variable=topping, width=12, height=3, bg=&quot;green&quot;, value=toppings[i],
                  activebackground=&quot;red&quot;, anchor=W, command=lambda: click(topping.get())).grid(row=i + 2, column=4,
                                                                                               padx=10, pady=10,
                                                                                               sticky=&quot;w&quot;)
  
  d_list = []
  ## you can also do grid inside pack frame unlike other scenarios
  
  r = IntVar()
  r.set(2)
  sauces = [&quot;Mayo Garlic&quot;, &quot;Barbecue&quot;, &quot;Peri Peri&quot;, &quot;Buffalo Ranch&quot;]
  sauce = StringVar()
  sauce.set(&quot;Mayo Garlic&quot;)
  
  
  def nextt():
      global d_list
      d_list = d_list[-1:]
      print(d_list)
  
  
  def click(value):
      d_list.append(value)
  
  
  for i in range(len(sauces)):
      Radiobutton(win, text=sauces[i], variable=sauce, width=12, height=3, bg=&quot;green&quot;, value=sauces[i],
                  activebackground=&quot;red&quot;, anchor=W, command=lambda: click(sauce.get())).grid(row=i + 2, column=5, padx=10,
                                                                                             pady=10, sticky=&quot;w&quot;)
  
  a_list = []
  ## you can also do grid inside pack frame unlike other scenarios
  
  r = IntVar()
  r.set(2)
  drinks = [&quot;Pepsi&quot;, &quot;Fanta&quot;, &quot;Sprite&quot;]
  drink = StringVar()
  drink.set(&quot;Pepsi&quot;)
  
  
  def nextt():
      global a_list
      a_list = a_list[-1:]
      print(a_list)
  
  
  def click(value):
      a_list.append(value)
  
  
  for i in range(len(drinks)):
      Radiobutton(win, text=drinks[i], variable=drink, width=12, height=3, bg=&quot;green&quot;, value=drinks[i],
                  activebackground=&quot;red&quot;, anchor=W, command=lambda: click(drink.get())).grid(row=i + 7, column=5, padx=10,
                                                                                             pady=10, sticky=&quot;w&quot;)
  
  win.mainloop()
  </code></pre>