title: Tkinter entry widget float
body: <p>I have been writing a tkinter application that takes floats from multiple entry widgets and then uses the floats in a calculation to produce a float that can then be displayed in an appropriate label.</p>
  
  <p>When I run the application I get 'ValueError: could not convert string to float:' and I can't use the floats in any calculations.</p>
  
  <p>This is a small chunk of the code:</p>
  
  <pre><code>def click_p1():
      p1 = entry_p1.get()
  
      try:
          p1 = float(p1)
          print (p1)
  
      except:
          print('Bad Input')
  
  
  button_p1 = Button(text = 'ENTER', command = click_p1).grid(row = 2, column = 1, stick = 'nsew')
  entry_p1 = Entry()
  entry_p1.grid(row = 2, column = 0, stick = 'nsew')
  
  p1 = float(entry_p1.get())
  p2 = float(entry_p2.get())
  t1 = float(entry_t1.get())
  t2 = float(entry_t2.get())
  a1 = math.log(p1) - math.log(p2)
  b1 = t2 - t1
  k1 = a1/b1
  e2hours = -k1*(120 + t1)
  p2hours += p1*math.exp(e2hours)
  print(p2hours)
  </code></pre>
  
  <p>How could I get the program to accept the number entered is a float and then use it in the calculation?</p>
  
  <p>I'm sorry if the answer is obvious, I'm quite new to programming and using tkinter.</p>