VS 代码模块 pygame 没有 init 成员 [英] VS code module pygame has no init member

查看:37
本文介绍了VS 代码模块 pygame 没有 init 成员的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学习pygame,所以我把它下载到VS代码中并开始编码.如您所知,您必须做的第一件事是导入 pygame,然后在 pygame.init() 之后,当我执行此操作时出现错误,提示 pygame 没有 init 成员.该消息会弹出一些 pygame 函数,例如 pygame.退出(),但不是与其他的,如 pygame.time.Clock().我在网上寻找答案,发现一些帖子告诉我向 settings.json 添加一些东西 - 当我没有做任何改变时,我尝试了其中的几个,但它们似乎都不起作用.据我了解,我应该能够运行代码,只是消息很烦人.

解决方案

当我使用模块pygame"时,我重现了你描述的问题:

(虽然代码可以执行,但是出现错误没有初始化成员")

解决方案:

请补充

<块引用>

python.linting.pylintArgs":[----extension-pkg-whitelist=1xml",],

settings.json"中,并使用最新版本的VScode.(版本:1.50.1)

结果:

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.

解决方案

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:

这篇关于VS 代码模块 pygame 没有 init 成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆