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")

enter image description here

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:

enter image description here

Logo

开发云社区提供前沿行业资讯和优质的学习知识,同时提供优质稳定、价格优惠的云主机、数据库、网络、云储存等云服务产品

更多推荐