title: My program freezes as soon as I click the "Calculate" button Python Tkinter
body: <p>I have the following program. I have figured out the way I want the numbers calculated. I am struggling with the interface. I want something super basic and simple but it seems to freeze every time I click the &quot;Calculate&quot; button. Anyone can give me some advice/help?</p>
  <pre><code>import random
  from tkinter import *
  
  def Calculate():
  
      revenue = revenue_field.get()
  
      total_hrs = int(revenue)/17.5
      total_hrs = round(total_hrs)
  
      monThur, friSun = 0, 0
  
      while (monThur*15 + friSun*20) != int(revenue) or monThur &gt; 960 or friSun &gt; 792:
          monThur = random.randint(0, total_hrs+1)
          friSun = total_hrs - monThur
  
      result = &quot;You need to have &quot; + str(monThur) + &quot; hours sold between Monday and Thursday and &quot; + str(friSun) + &quot; hours sold between Friday and Sunday to achieve a revenue of &quot; + str(revenue)
  
      result_field.insert(END, result + '\n')
  
  
  gui = Tk()
  
  
  gui.configure(background=&quot;light green&quot;)
  
  gui.title(&quot;Reverse Revenue&quot;)
  
  gui.geometry(&quot;270x150&quot;)
  
  revenue = IntVar()
  revenue_field = Entry(gui)
  revenue_field.grid(columnspan=4, ipadx=70)
  
  
  button1 = Button(gui, text=' Calculate ', fg='black', bg='red', command=Calculate, height=1, width=7)
  button1.grid(row=2, column=2)
  
  result_field = Text(gui)
  
  
  gui.mainloop()
  </code></pre>
  <p>EDIT: I have fixed the freezing but now when I click Calculate, nothing happens, no ouput, nothing.</p>