title: Why do the functions run as soon as my code runs? Turtle and TKinter problems
body: <p>What should happen is that I run the code, the TKinter window opens and you just click a button, turtle opens and draws the shape.</p>
  <p>However when I run my code the Tkinter window and the turtle window open but it just instantly starts drawing the shapes. Also the Tkinter window doesn't have any of the buttons either.</p>
  <p>I'm not sure what is wrong with my code. Please can I have some help.</p>
  <p>My code:</p>
  <pre><code>import tkinter as tk
  import turtle as t
  
  window = tk.Tk()
  window.geometry(&quot;500x500&quot;)
  
  def square():
      t.forward(200)
      t.right(90)
      t.forward(200)
      t.right(90)
      t.forward(200)
      t.right(90)
      t.forward(200)
      t.exitonclick
  
  def triangle():
      t.forward(200)
      t.right(135)
      t.forward(200)
      t.right(115)
      t.forward(200)
      t.exitonclick
  
  def rectangle():
      t.forward(200)
      t.right(90)
      t.forward(100)
      t.right(90)
      t.forward(200)
      t.right(90)
      t.forward(100)
      t.exitonclick
  
  b1 = tk.Button(window, command=square(), text=&quot;Square&quot;, bg=&quot;Red&quot;)
  b2 = tk.Button(window, command=triangle(), text=&quot;Triangle&quot;, bg=&quot;Cyan&quot;)
  b3 = tk.Button(window, command=rectangle(), text=&quot;Rectangle&quot;, bg=&quot;Gold&quot;)
  
  b1.place(x=0,y=0)
  b2.place(x=0,y=30)
  b3.place(x=0,y=60)
  
  window.mainloop 
  </code></pre>