社区
脚本语言
帖子详情
pygame.init()报错
qt-wu
2018-07-31 03:45:59
用pycharm导入pygame模块并运行pygame.init()时报错,异常提示:’module pygame has no attribute init‘,有大神遇到这种情况的吗
...全文
369
2
打赏
收藏
pygame.init()报错
用pycharm导入pygame模块并运行pygame.init()时报错,异常提示:’module pygame has no attribute init‘,有大神遇到这种情况的吗
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
2 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
dengyunxing
2019-11-13
打赏
举报
回复
遇到了,在vscode中报错,但是可以运行。
拖沓天王不沓拖
2019-01-23
打赏
举报
回复
同样的错误,而且在idle中也报错
pygame
库实现移动底座弹球小游戏
本文实例为大家分享了
pygame
实现移动底座弹球的具体代码,供大家参考,具体内容如下 输出结果: 实现代码: # -*- coding: utf-8 -*- #Py之
pygame
:有趣好玩——利用
pygame
库实现一个移动底座弹球的小游戏 import
pygame
as pg from
pygame
.locals import * #将
pygame
所有常量导入,如后面的QUIT from time import sleep import sys #设置基本屏幕参数 pg.
init
() #初始化,如果没有的话字体会
报错
等等 scr=pg.display.set_
python中
pygame
.
init
_
pygame
.
init
()
报错
pygame
.
init
()ALSA lib confmisc.c:768:(parse_card) cannot find card '0'ALSA lib conf.c:4248:(_snd_config_evaluate) function snd_func_card_driver returned error: No such file or directoryALSA lib confmi...
pygame
.error: video system not
init
ialized
前提已经有初始化:
pygame
.
init
() # 游戏初始化 如果
报错
是因为这里: 实际上应该是:quit大小写的原因,修改后如下 #开始写回圈 running = True #开始游戏肯定是继续,所以true while running: #取得输入 clock.tick(FPS) #一秒钟最多执行60次,每个人的电脑每秒钟执行次数不一样,所以要控制 for event in
pygame
.event.get(): if event.type ==
出现
pygame
.error: font not
init
ialized问题,记得检查一下程序前面是否调用
pygame
.
init
()
pygame
.
init
()函数,它必须在导入
pygame
模块之后,且开始使用
Pygame
提供的任何函数前调用,你不必知道此函数的作用,只需要知道,为了使用
pygame
函数能正常工作,必须在一开始就调用它。如果你碰到像
pygame
.error: font not
init
ialized这样的错识,请检查一下是否忘记了在程序前面调用
pygame
.
init
()...
pygame
.error: mixer not
init
ialized和
pygame
.error: WASAPI can‘t find requested audio endpoint: 找不到元素。
在使用Python开发游戏时难免会用到
Pygame
模块,其中该模块有个关于声音函数,使用该函数我们可以为我们的游戏添加音效。 问题描述: 要使用声音模块我们就必须在主函数开头初始化我们的游戏,因此我们在主函数的开头就添加以下语句来初始化游戏。 # 游戏初始化
pygame
.
init
() 但是当我运行程序时,发现游戏窗口出现闪退的情况,并且出现
报错
信息,如下: D:\Game\TankWar\venv\Scripts\python.exe D:/Game/TankWar/main.py pygam
脚本语言
37,721
社区成员
34,239
社区内容
发帖
与我相关
我的任务
脚本语言
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
复制链接
扫一扫
分享
社区描述
JavaScript,VBScript,AngleScript,ActionScript,Shell,Perl,Ruby,Lua,Tcl,Scala,MaxScript 等脚本语言交流。
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
试试用AI创作助手写篇文章吧
+ 用AI写文章