title: turtle defined function not executing all code at once
body: <p>I'm trying to write a program that allows me to plot some simple coordinates using the turtle module and to make it more user friendly I wanted display a cross every time the user pressed the left mouse button to plot a point. For some reason the last bit of the cross() function ie. the last line of the cross won't draw or come up until the left mouse button is pressed again. I'm really confused as to why this is happening because the code is definitely being executed. Any help would be greatly appreciated!</p>
  <pre><code>
  wn = t.Screen()
  wn.title(&quot;graph&quot;)
  wn.setup(width=600, height=600)
  wn.tracer(0)
  wn.update()
  
  pen = t.Turtle()
  pen.color(&quot;black&quot;)
  pen.shape(&quot;classic&quot;)
  pen.goto(0, 0)
  pen.ht()
  
  x = 10
  y = 10
  
  def cross(x, y):
      print(x, y)
      pen.pensize(2.5)
      pen.pu()
      pen.goto(x, y)
      pen.pd()
      pen.seth(225)
      pen.color(&quot;red&quot;)
      pen.fd(50)
      pen.color(&quot;black&quot;)
  
      pen.pu()
      pen.goto(x, y)
      pen.pd()
      pen.left(180)
      pen.fd(50)
  
      pen.pu()
      pen.goto(x, y)
      pen.seth(315)
      pen.pd()
      pen.color(&quot;green&quot;)
      pen.fd(50)
  
      pen.pu()
      pen.goto(x, y)
      pen.left(180)
      pen.pd()
      pen.color(&quot;yellow&quot;)
      pen.fd(50) #for some reason this is not being done
      print(&quot;now&quot;)
  
  cross(x, y)
  
  while True:
      wn.update()
      wn.onscreenclick(cross)
      wn.mainloop()
  </code></pre>