I try to draw a pentacle with built-in lib turtle.
Environment:
- Windows 10
- Python 3.5
- PyCharm Community Edition 2017.1.5
code:
import turtle
turtle.fillcolor('red')
turtle.begin_fill()
while True:
turtle.forward(200)
turtle.right(144)
if abs(turtle.pos()) < 1:
break
turtle.end_fill()
All of the method in turtle, including the 'fillcolor', 'begin_fill', 'forward', 'right', and 'pos', etc, are warned by PyCharm with "Cannot find reference 'xxx' in 'turtle.py'" and the auto-complete on these methods failed along with the warnings. But it's strange that the script can run normally and correctly as expected.
I've searched SO for answers, and there are a few related questions but not the same, actually:
- Cannot find reference 'xxx' in '__init__.py'
- Unresolved reference 'print'
All of the answers to the questions above cannot solve this problem.
According to the first batch of comments and answers, some more info provided as below:
- I almost believe I'm using turtle for Python 3.x, because there is only one turtle.py file in my laptop, under the dir 'C:\Python35\Lib'. BTW, if it's still possible I'm using turtle for Python 2.x, how can I check this info and how can I update this builtin lib in the default dir?
- I almost believe I'm not using the virtualenv, and the interpreter for my proj is Python 3.5.2
(Unfortunatly, I still cannot upload image)