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 ...
随机推荐
- 运行jar包使用外部依赖
nohup java -Dloader.path="lib/" -Dfile.encoding=utf-8 -jar test.jar > test.out 2>&am ...
- 【c# 操作符】- nameof用法
最重要的是nameof不会影响性能! nameof有什么用?主要用解决 类成员名做参数替代成员们的字符串做参数,如下: using System; namespace csharp6 { intern ...
- C# 开始支持动态化编程
在.NET 4.0的运行时进行动态编程时,我们引入了一个新功能:动态语言运行时.可以这样理解,CLR的目的是为静态类型的编程语言提供一个统一的框架或编程模型,而DLR便是在.NET平台上为动态语言提供 ...
- OJ教程--递归
弄清楚递归的基本思想,递归函数的运行过程,暂且不考虑是否使用递归在效率方面的差异. 题目 1: 数的组合问题.从1,2,-,n中取出m个数,将所有组合按照字典顺序列出.如n=3,m=2时,输出:12 ...
- kibana命令复制索引
POST _reindex { "source": { "index": "原索引名称" }, "dest": { &q ...
- 扩展我们的分析处理服务(Smartly.io):使用 Citus 对 PostgreSQL 数据库进行分片
原文:Scaling Our Analytical Processing Service: Sharding a PostgreSQL Database with Citus 在线广告商正在根据绩效数 ...
- CSS复合选择器,元素的显示模式,CSS背景设置
欢迎大家去博客冰山一树Sankey,浏览效果更好.直接右上角搜索该标题即可 博客园主页:博客园主页-冰山一树Sankey CSDN主页:CSDN主页-冰山一树Sankey 前端学习:学习地址:黑马程序 ...
- git flow 工作流程以及常用命令
一.分支介绍 master 也是产品分支,只有一个,一般情况下不会在这个分支上进行代码操作 develop 只有一个,新特性的开发是基于 develop 开发的,但是不能直接在 develop 上进行 ...
- laravel7 权限菜单设置简易升缩
1:数据库填写数据,pid=0为顶级菜单,pid=对应的id为顶级菜单的子菜单 2:laravel7 创建模型并链接对应的表名 <?php namespace App\models; use I ...
- think php 框架下拉分页
//以对象的形式获取数据库$data变量的信息,将lastPage()传输至页面 $lastpage = $data->lastPage(); $this->assign('lastpag ...