VS code module pygame has no init member
Answer a question
I wanted to learn pygame so I downloaded it into VS code and began coding. As you know one of the first things you have to do is import pygame and after that pygame.init() when i did that there was an error saying pygame has no init member.The message pops up with some pygame functions such as pygame.quit(), but not with other ones such as pygame.time.Clock(). I looked online for answers and found some post that told me to add something to settings.json - when I did nothing had changed, I tried a couple of these but none of them seem to work. From what I understand, I should be able to run the code, it's just that the messages are annoying.
Answers
When I used the module "pygame
", I reproduced the problem you described:
(Although the code can be executed, there is an error "no init member")
Solution:
Please add
"python.linting.pylintArgs": [ "----extension-pkg-whitelist=1xml", ],
in "settings.json
", and use the latest version of VScode.( Version: 1.50.1 )
result:
更多推荐
所有评论(0)