【发布时间】:2021-05-29 20:23:59
【问题描述】:
我正在尝试 python 的 turtle 模块,虽然程序执行正确,但 PyLint 一直错误地将程序的某些部分标记为错误。程序polygon.py 包含以下内容:
import turtle
t = turtle.Turtle()
t.fd(100)
turtle.mainloop()
这个程序按预期执行,海龟向前移动了 100 像素。但是,在 VSCode 中,PyLint 将turtle.mainloop() 下划线表示为错误,表示:
Module 'turtle' has no 'mainloop' member pylint(no-member)
此外,在实际的turtle.py 模块中,提及mainloop() 以及其他一些成员也被标记为错误,表示:
"mainloop" is not defined Pylance (reportUndefinedVariable)
我尝试卸载并重新安装 PyLint,但仍然显示错误。我该如何修复它们,或者至少考虑到程序可以正常工作来隐藏它们?
【问题讨论】:
标签: python tkinter python-turtle