在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的更多相关文章

  1. python中video system not initialized怎么解决

    今天在github上找到一个用pygame做的Python游戏,但是clone到本地运行的时候却冒出了“mixer system not initialized”这样的问题.其实这句话说的就是音频混音 ...

  2. CodeForces 527B Error Correct System

    Error Correct System Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I6 ...

  3. CF Error Correct System

    Error Correct System time limit per test 2 seconds memory limit per test 256 megabytes input standar ...

  4. E514:write error(file system full?)

    vi编辑某文件,保存时报错,提示:E514: write error (file system full?)---写入错误,磁盘满了? 查看磁盘空间:df -h根目录磁盘空间已满,used%100. ...

  5. Error Correct System(模拟)

     Error Correct System Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I ...

  6. 解决编译时出错提示: 'error: array must be initialized with a brace-enclosed initializer' 的错误

    编译出现这个错误的原因非常简单编译的标准不相同.如果用stdc90,这个就可以直接编译通过了. 下面是代码例子: ...... ] = NULL;或者 :char cmd[256] = '\0'; . ...

  7. Bus Video System CodeForces - 978E (思维)

    The busses in Berland are equipped with a video surveillance system. The system records information ...

  8. 解决 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 解决 ...

  9. pygame.error: Couldn't open images/ship.bmp

    在<python编程:从入门到实践>这本书中的<外星人入侵>的项目里有如下代码:  Python Code  123456789101112131415   import py ...

随机推荐

  1. kyverno VS gateKeeper

    kyverno VS gateKeeper 概述 这两组开源工具都是是基于kubernetes 的webhook机制,支持validatingwebhook和mutatingwebhook.整体思路上 ...

  2. layout_gravity和gravity

    layout_gravity是指控件本身的位置,gravity是指控件内元素的位置.

  3. Windows运行(Win+R)快速启动所有程序(自定义)

    运行Win+R我们都会用,等同于开始菜单的"运行".注意,只是效果等同, 从速度来看,按win+r比用鼠标要快很多倍.用win+r启动常用程序 最常用的是输入cmd打开命令行或ca ...

  4. python初略复习(2)及python相关数据分析模块的介绍

    常用模块 Python中的模块在使用的时候统一都是采用的句点符(.) # 就是模块名点方法的形式 import time time.time() import datetime datetime.da ...

  5. Tableau学习Step6一如何制作炫彩地图

    Tableau学习Step6一如何制作炫彩地图 本文首发于博客冰山一树Sankey,去博客浏览效果更好. 一.统计地图概述 1.1 统计地图的基本概念 统计地图的本质:数据的正确对应 将数据信息和地理 ...

  6. Cloud Computing Chapter3 (云计算第三章)

    本篇文章是对课程大型软件系统设计与体系结构(双语)[又名:云计算]的课堂内容总结,适用于大连交通大学. Cloud Computing Chapter3 Understanding Cloud Com ...

  7. PHP pdf转png windows版本

    链接:https://pan.baidu.com/s/1Bli-2HkucRTYTeujkcsmjg&shfl=sharepset 提取码:2une 1.php_imagick扩展 (1)下载 ...

  8. CF587F&CF547E题解

    这两道题好像啊 贡献一种使用SAM和ACAM草两道题的方法 下面假装有 \(O(\sum |S|=m)=O(n)\). 你看看,这CF换过多少个出题人啦?换汤不换药啦!其实这两道题是同一个人出的 CF ...

  9. Spring-MyBatis的配置文件

    <?xml version="1.0" encoding="UTF8"?> <beans xmlns="http://www.spr ...

  10. FrameScan CMS漏洞扫描

    工具简介 GithubL:https://github.com/qianxiao996/FrameScan FrameScan是一款python3编写的简易的cms漏洞检测框架,支持多种检测方式,支持 ...