【发布时间】:2013-09-16 22:38:03
【问题描述】:
这个确切的问题是去年四月在这个论坛上提出的。但是,唯一的答案是:“您的脚本在我的系统上运行,检查并确保您拥有适用于您的 python 版本的 pygame 模块。”所以我先检查了这个,然后检查了。 (我有 Python 2.7 和 Python 2.7 的 Pygame 版本 1.9.1。)
所以不是这样,但是下面的代码会产生与其他人报告的相同的错误:
This application has requested the runtime to terminate it in an unusual way. Please contact the application's support team for more info.
我希望最初的发帖人说他们做了什么来修复它,因为我很难过。请注意,我在尝试运行它的机器上没有管理员权限。会不会是这个问题?
脚本如下。 (这直接取自Beginning Game Development with Python and Pygame一书。)它会一直运行到您尝试调整窗口大小的那一刻。
background_image_filename = 'sushiplate.jpg'
import pygame
from pygame.locals import *
from sys import exit
SCREEN_SIZE = (640, 480)
pygame.init()
screen = pygame.display.set_mode(SCREEN_SIZE, RESIZABLE, 32)
background = pygame.image.load(background_image_filename).convert()
while True:
event = pygame.event.wait()
if event.type == QUIT:
exit()
if event.type == VIDEORESIZE:
SCREEN_SIZE = event.size
screen = pygame.display.set_mode(SCREEN_SIZE, RESIZABLE, 32)
pygame.display.set_caption("Window resized to "+str(event.size))
screen_width, screen_height = SCREEN_SIZE
for y in range(0, screen_height, background.get_height()):
for x in range(0, screen_width, background.get_width()):
screen.blit(background, (x, y))
pygame.display.update()
【问题讨论】:
-
可能有用的一件事是问另一个问题的 OP,谁知道呢,他可能回应。
标签: python python-2.7 pygame