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 ...
随机推荐
- 递归Recursion
从开始自学写代码开始,就感觉递归是个特别美丽的算法. "如果使用循环,程序的性能可能更高:如果使用递归,程序可能更容易理解.如何选择要看什么对你来说更重要." 编写递归函数时,必须 ...
- Solving Large-Scale Granular Resource Allocation Problems Efficiently with POP(2021-POP-SOSP-文献阅读笔记)
读者 这篇文章来自2021的SOSP,单位是斯坦福大学和微软.选该文章的理由有二,一是资源分配的主题较为相关:二是文章结构.语言很清晰,读起来很舒服. 本文的中心思想可以概括为:分化瓦解,各个击破.即 ...
- Oracle之非关系数据库
什么是非关系型数据库? 非关系型数据库它的全称是Not Only SQL(简称 NoSQL数据库)是用于存储和检索数据的非关系数据库系统.在当今世界,我们不应该只以没有预定义固定模式的表格式存储所有数 ...
- 从零开始,开发一个 Web Office 套件(7):新的问题—— Click 事件的 z-index
这是一个系列博客,最终目的是要做一个基于 HTML Canvas 的.类似于微软 Office 的 Web Office 套件(包括:文档.表格.幻灯片--等等). 博客园:<从零开始, 开发一 ...
- Bugku CTF_web5
1.打开网页,得到信息如下 2.打开hackbar,在body里传入post参数. 3.得到flag如下 4.主要考察以下几点: ->php无论是通过get请求还是post请求得到的数据都是字符 ...
- jmeter之如何减负-实现稳定超高并发测试(性能调优)之正确添加监听器
jmeter之如何减负-实现稳定超高并发测试(性能调优)在测试过程中,初学者使用工具不当,添加众多监控组件,非常想看到实时报告,跑不了一会,jmeter就卡死,只得重启 下面来总结下如何正确使用jme ...
- json web token JWT实现TP5创建和验证
根据博客进行jwt初始化配置 https://blog.csdn.net/weixin_43389208/article/details/117442266?spm=1001.2014.3001.55 ...
- nginx反向代理配置(conf文件中的nginx)
########### 每个指令必须有分号结束.##################user administrator administrators; #配置用户或者组,默认为nobody nob ...
- tensorflow源码解析之framework-graph
目录 什么是graph 图构建辅助函数 graph_transfer_info 关系图 涉及的文件 迭代记录 1. 什么是graph graph是TF计算设计的载体,如果拿TF代码的执行和Java代码 ...
- 2022年官网下安装Kibana最全版与官网查阅方法(Kibana8.1.0+Elasticsearch8.1.0)
一.环境整合(需要提前装好) 构建工具(参考工具部署方式) 软件名称 版本 相关文章推荐 Elasticsearch ..* https://www.cnblogs.com/liuyangfirst/ ...