I'm new to programming and I downloaded Python and got it running in Visual Studio Code. I was messing around with the turtle module and its functions.
The functions themselves work but pylint
marks it as an error and says that there isn't a "member" like what I coded.
How would I go about fixing this error? (I don't want to set it to "ignore" the issue but rather recognize that the code I'm typing in is valid and comes from the turtle module)
The turtle module exposes two interfaces, a functional one and an object-oriented one. The functional interface is derived programatically from the object-oriented interface at load time, so static analysis tools can't see it, thus your pylint
error. Instead of the functional interface:
import turtle
turtle.forward(100)
turtle.mainloop()
For which pylint
generates no-member
, try using the object-oriented interface:
from turtle import Screen, Turtle
screen = Screen()
turtle = Turtle()
turtle.forward(100)
screen.mainloop()
This particular import
for turtle blocks out the functional interface and I recommend it as folks often run into bugs by mixing both the OOP and functional interaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With