0

i am trying to generate this figure in python under three different version (2.7.6 & 2.7.11 & 3.5.1)

and yet every time i get a shell error stating {AttributeError: 'module' object has no attribute 'Screen'}

what is the problem here

I have even tried in writing individual command in IDLE and they are responding one at a time. but not as a script.

def draw_square ():

import turtle
playground = turtle.Screen()
playground.bgcolor("red")
playground.screensize(600,400)

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)

playground.exitonclick()

draw_square()

Community
  • 1
  • 1
Lucky Ansari
  • 51
  • 1
  • 1
  • 9
  • 1
    You probably have a `turtle.py` file somewhere that is imported instead. Add `print(turtle.__file__)` right after the `import turtle` line to find out where. – Martijn Pieters May 19 '16 at 17:35
  • Assuming the duplicate is wrong, are you sure you're using the turtle module correctly? I have python3 and it's possible the API's changed, but I think you should do: myturtle = turtle.Turtle() and then you can do myturtle.screen() – Foon May 19 '16 at 21:35
  • hello i have tried both of the above suggested methods, but the problem still stands, i even switched to ver 3.5.1 but even there i am getting the same error. – Lucky Ansari May 22 '16 at 15:33

0 Answers0