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 ...
随机推荐
- 【C# 线程】线程局部存储(TLS)理论部分 ThreadStatic|LocalDataStoreSlot|ThreadLocal<T>
线程本地存储(TLS:Thread Local Storage) 线程本地存储(Thread Local Storage),字面意思就是专属某个线程的存储空间.变量大体上分为全局变量和局部变量,一个进 ...
- C# new操作符的作用
CLR要求所有对象(实例)都用new操作符创建,那么new操作符做了哪些事呢?1. 计算字节数 计算类型及其所有基类型(父类)中定义的所有实例字段需要的字节数.堆上每个对象都需要一些额外的成员, ...
- spring 核心容器api
spring api : https://docs.spring.io/spring-framework/docs/current/javadoc-api/ BeanFactory 才是 Spring ...
- -bash: ./1.sh: /bin/bash^M: bad interpreter: No such file or directory
1.开始以为是sh路径问题,用which查看是正确的. 2.用vim打开文件:vi 文件名. 3.按':'号键,输入查看文件的格式命令set ff或set fileformat. 4.可以看到格式是D ...
- java ssh远程服务器并执行多条shell命令
java ssh远程服务器并执行多条命令 import java.io.BufferedReader; import java.io.IOException; import java.io.Input ...
- 3D打印第二弹:狗牌
给朋友做一个狗牌(误,给朋友的狗狗做一个狗牌 1. 设计 没有设计功底,看看别人是如何做的,搜到一个狗牌: 照着这个做一个,正面是上图这种的:狗狗名字+狗爪子:另一面是手机号加联系说明文字. 2. 建 ...
- Leaflet:LayerGroup、FeatureGroup
LayerGroup(Layer) Layer 用法:把一些Layer集中到一个组Group中,以便作为一个整体进行操作.如果把该Group加入到了Map中,任何从这个Group增加或者移除Layer ...
- 国产化之Arm64 CPU+银河麒麟系统安装.NetCore
背景 某个项目需要实现基础软件全部国产化,其中操作系统指定银河麒麟,银河麒麟就是一个Linux发行版,数据库使用达梦V8,这个数据库很多概念和Oracle相似,CPU平台的范围:龙芯.飞腾.鲲鹏等. ...
- MySQL优化之索引解析
索引的本质 MySQL索引或者说其他关系型数据库的索引的本质就只有一句话,以空间换时间. 索引的作用 索引关系型数据库为了加速对表中行数据检索的(磁盘存储的)数据结构 索引的分类 数据结构上面的分类 ...
- 理解 MVCC
MongoDB.MySQL.Oracle.PostgreSQL 等事务型数据库都有 mvcc 的概念. MVCC: 即多版本并发控制,主要是为了提高数据库的读写性能,让数据库在读写的时候不用去加锁.m ...