pygame.error: video system not initialized
在pygame写游戏出现pygame.error: video system not initialized
源代码
import sys
import pygame
def run_game():
pygame.init()
screen = pygame.display.set_mode((1200,800))
pygame.display.set_caption("Alien Invasion")
#主循环
while True:
#监视键盘和鼠标事件
for event in pygame.event.get():
if event.type==pygame.QUIT:
sys.exit()
#让最近屏幕可见
pygame.display.flip()
run_game()
报错
Traceback (most recent call last):
File "D:/project/python/FirstGame/alien_invasion.py", line 11, in <module>
for event in pygame.event.get():
pygame.error: video system not initialized
原因在于while true没有放进主循环,没有缩进
pygame.error: video system not initialized的更多相关文章
- python中video system not initialized怎么解决
今天在github上找到一个用pygame做的Python游戏,但是clone到本地运行的时候却冒出了“mixer system not initialized”这样的问题.其实这句话说的就是音频混音 ...
- CodeForces 527B Error Correct System
Error Correct System Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I6 ...
- CF Error Correct System
Error Correct System time limit per test 2 seconds memory limit per test 256 megabytes input standar ...
- E514:write error(file system full?)
vi编辑某文件,保存时报错,提示:E514: write error (file system full?)---写入错误,磁盘满了? 查看磁盘空间:df -h根目录磁盘空间已满,used%100. ...
- Error Correct System(模拟)
Error Correct System Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I ...
- 解决编译时出错提示: 'error: array must be initialized with a brace-enclosed initializer' 的错误
编译出现这个错误的原因非常简单编译的标准不相同.如果用stdc90,这个就可以直接编译通过了. 下面是代码例子: ...... ] = NULL;或者 :char cmd[256] = '\0'; . ...
- Bus Video System CodeForces - 978E (思维)
The busses in Berland are equipped with a video surveillance system. The system records information ...
- 解决 Error: ENOSPC: System limit for number of file watchers reached
manjaro 18.0 kde版本 运行 yarn test报错 Error: ENOSPC: System limit for number of file watchers reached 解决 ...
- pygame.error: Couldn't open images/ship.bmp
在<python编程:从入门到实践>这本书中的<外星人入侵>的项目里有如下代码: Python Code 123456789101112131415 import py ...
随机推荐
- Install VMware Tools in CentOS 7 command line mode
1.首先启动CentOS 7,在VMware中点击上方"VM",点击"Install VMware Tools..."(如已安装则显示"Reinsta ...
- Oracle的用户权限和角色
用户和权限 LOCK|UNLOCK创建用户时是否锁定,默认为锁定状态.锁定的用户无法正常的登录进行数据库操作. --给普通用户SCOTT解锁,同时把SCOTT用户的密码进行修改 --语法结构:ALTE ...
- linux时钟校准
## 查看系统时间 date ## 查看硬件时间 hwclock ## 手动设置时间 date -s "20210507 17:55:00" ## 同步硬件时间 hwclock - ...
- ORACLE 12c RAC日常维护命令
转至:https://blog.51cto.com/ixdba/901545 CRS提供了很多命令可以管理和查看集群服务状态,常用的有crs_stat.crs_start.crs_stop.crsct ...
- jq给手机号加密
效果: HTML代码: <!-- 1手机绑定 --> <div class="memberuser_box"> <di ...
- linux多进/线程编程(1)—— 基础概念(PCB、MMU、进程状态)
学习大概就是不断迭代.重构的过程,不复习的学习是不负责任的,亦是无用的. 本系列博客主要作为个人记录,主要是贴图和代码,不做详细解释,以后有时间可能会重写:从下一篇开始上代码,代码可以运行是对自己的最 ...
- (第二章第四部分)TensorFlow框架之TFRecords数据的存储与读取
系列博客链接: (第二章第一部分)TensorFlow框架之文件读取流程:https://www.cnblogs.com/kongweisi/p/11050302.html (第二章第二部分)Tens ...
- 大学英语四级之听力Key Words
Key Words关键词 所谓关键词,指的是短文中能够标志着正确答案的词,也就是说,关键词后面往往是正确答案 听力中的关键词可为宏观和微观两方面,一般出现在如下10种位置. 一.宏观方向(主旨大意) ...
- js json.stringfy()和json.parse()的用法
1.JSON.parse;作用:将JavaScript对象表示法的JSON字符串转换为对象(字符串转对象)语法:JSON.parse(text [, reviver])text 必选. 一个有效的 J ...
- phpstorm xdebug 断点测试
参考博客: https://blog.csdn.net/J2778322217/article/details/123111960?spm=1001.2014.3001.5502 https://no ...