title: Python percentage calculator
body: <p>I'm having some trouble with this code to calculate percentages. It shows an error message in the calculation, but I don't know exactly how to show the result. Here's my code:</p>
  
  <pre><code>from tkinter import*
  import math
  
  
  class Application(Frame):
  
      def __init__(self, master):
          Frame.__init__(self, master)
          self.grid()
          self.widget()
  
  
      def widget(self):
          self.ori = Label(self, text ="Insira o número desejado: ")
          self.ori.grid(row = 1, column = 0, columnspan = 2, sticky =W)
  
          self.ori2 = Label(self, text ="Insira a porcentagem desejada: ")
          self.ori2.grid(row = 2, column = 0, columnspan = 2, sticky =W)
  
          self.num =float(Entry.cget(self))
          self.num.grid(row = 1, column = 2, sticky =E)
  
          self.num1 =float(Entry.cget()get(self))
          self.num1.grid(row = 2, column = 2, sticky =E)
  
          self.label = Label(self, text="A porcentagem do número selecionado é: ")
          self.label.grid(row=3, column=0, columnspan=2, sticky=W)
  
          btstart = Button(self, text="Calcular", width=7, command=self.cal)
          btstart.grid(row = 5,column =1)
  
          btstop = Button(self, text="Sair", width=7, command=self.close_window)
          btstop.grid(row = 5,column =2)
  
  
      def cal(self):
          self.calc = math(self.num * self.num1) / 100
          print(self.cal)
  
  
      def close_window(Application):
          root.destroy()
  
  
  root = Tk()
  root.title("Programa de calculo")
  root.geometry("400x150")
  
  app = Application(root)
  
  root.mainloop()
  </code></pre>