title: AttributeError: module 'turtle' has no attribute 'screen' in spyder?
body: <p>What's wrong with this code? I tried to run <a href="https://i.stack.imgur.com/IMeyG.png" rel="nofollow noreferrer">this code</a> but in the output' <code>AttributeError: module 'turtle' has no attribute 'screen'</code> is shown:</p>
  
  <pre><code>import turtle
  
  def draw_square():
      window = turtle.screen()
      window.bgcolor("red")
  
      brad = turtle.turtle()
      brad.forward(100)
      brad.right(90)
      brad.forward(100)
      brad.right(90)
      brad.forward(100)
      brad.right(90)
      brad.forward(100)
      brad.right(90)
  
      window.exitonclick()
  
  draw_square()
  turtle.done()
  turtle.bye()
  </code></pre>