下面这段代码抛出一个错误:
while True:
event = pygame.event.wait()
if (event.type == ENDSONG):
queue_song()
这就是它的意思:
File "pygametest.py", line 22, in <module>
event = pygame.event.wait()
pygame.error: video system not initialized
我所做的大多数挖掘都表明,错误源于pygame.init()没有运行,但这正是我的代
这是你在游戏中可以做的最简单的代码。它所做的就是创建一个窗口并允许您关闭它。然而,我得到的错误pygame.error:视频系统没有初始化。我在网上搜索了这个,似乎大多数人都忘记打电话给pygame.init()了。我不知道为什么我会犯这个错误。
import pygame
pygame.init()
screen = pygame.display.set_mode((900,500))
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygam
我是第一次使用call by sharing,搜索结果但没有答案,我想通过共享call传递参数 下面是我的代码: #!/usr/bin/python
import sys,os
import pygame
class Setting():
'''how to deliver self.w and self.h into pic'''
pic = pygame.transform.smoothscale(pygame.image.load("pic.png"),(self.w,self.h)) #how
这是个奇怪的情况。
所以我试着用python做一个游戏,它要求我把一个角色的图片(名字叫Minty,只是为了澄清代码),我按照任何人都能做的方式来做。然而,这种情况会发生:
我负责运行密码。游戏窗口打开了。到目前一切尚好。然而,没有图像。没有回溯。我试着把程序消灭掉。然后图像突然出现。等等,什么?
为什么会发生这种情况?有人发生过这种事吗?这是我的代码(我删除了所有不必要的部分)。
import sys
import time
import pygame
from pygame.locals import *
pygame.init()
#MAIN GAME LOOP
while True:
为什么在没有在代码开始时调用pygame.init()的情况下,游戏对我有效呢?我只是出于好奇才问这个问题,因为没有pygame.init(),它也能工作。
编辑-示例
我有以下几点:
import pygame
#pygame.init()
TV=pygame.display.set_mode((500,500))
runs=1
while runs:
for e in pygame.event.get():
if e.type==pygame.QUIT:
runs=0
如果我关闭屏幕(使用“关闭”按钮),我也会使用未注释的pygame.in
我正在学习游戏,在绝大多数教程中,据说在做任何事情之前都应该运行pygame.init()。我做了一个特定的教程,并像一个人一样键入代码,并注意到,例如,在示例之后,没有pygame.init(),也没有任何模块的显式初始化。
例如,以下工作(至少对我而言)没有任何问题:
import pygame
screen = pygame.display.set_mode((600, 400))
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
ra
研究了几个小时后,我想不出为什么会触发这个错误。下面是完整的信息:
pygame 1.9.6
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "snake.py", line 37, in <module>
redraw_window()
File "snake.py", line 23, in redraw_window
win.fill((0, 0,
为什么pygame.event.get()会给出这个错误?
错误:视频系统未初始化
代码是功能性的,但在执行函数后会出现此错误。
pygame.event.get()
while not pygame.mouse.get_pressed()[0]:
key = pygame.key.get_pressed()
if key[pygame.K_SPACE]:
pygame.quit()
pygame.event.get()
程序退出,但给出了上述错误。
所以我决定开始制作一个游戏,我对它进行了一些测试,然后我得到了这个错误:
Traceback (most recent call last):
File "TheAviGame.py", line 15, in <module>
font = pygame.font.Font(None,25)
pygame.error: font not initialized
我不知道到目前为止我做错了什么。代码:
#!/usr/bin/python
import pygame
blue = (25,25,112)
black = (0,0,0)
red = (255
我在做Magento分机。当您尝试在Magento中使用jQuery时,Magento有一个已知的问题,因为Magento使用了原型库。
它的工作是将您的jQuery代码置于这样的冲突模式中.
jQuery.noConflict();
一旦我这样做,它解决了我90%的问题,我的JavaScript错误。然而,我现在对JavaScript还有三个主要的问题,我相信它们是相关的.
Uncaught TypeError: undefined is not a function
当我看到它报告这些错误的行号时,我看到.
第1168行jQuery(".acc-wizard")
在一个库中,我有一个A类,它创建并填充了一个C类的工厂方法。然后,返回的对象被分配给B类中的一个静态成员var。我的问题是,返回值优化似乎没有启动,至少在Visual中,它在XCode (使用clang)中正常工作。所发生的情况是,A类的d-tor在使用定义的移动赋值运算符()之前称为。在d-tor中,我在A中释放了一些内存,然后数据就不再有效了。
class A {
public:
A();
A(const A &other);
A(const A &&other);
A& operator = (const A &other);