我想知道如果有人可以幫我pygame(Python)。我一直從我的代碼得到一個錯誤:Pygame沒有視頻
bif ="bg.jpg"
mif = "mouse.png"
import pygame
import sys
from pygame.locals import *
pygame.init()
screen=pygame.display.set_mode((682,415),0,32)
backround= pygame.image.load(bif).convert()
mouse_c=pygame.image.load(mif).convert()
x, y =0,0
movex, movey =0,0
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
if event.tpye == KEYDOWN:
if event.key==K_LEFT:
movex =-1
elif event.key==K_RIGHT:
movex=+1
elif event.key ==K_UP:
movey=-1
elif event.key==K_DOWN:
movey=+1
而我得到的錯誤是:
Traceback (most recent call last):
File "C:\Documents and Settings\Aidan\Desktop\Mygame.py", line 15, in <module>
screen=pygame.display.set_mode((682,415),0,32)
pygame.error: No available video device`
我在Windows XP上運行的索尼Vaio VGN-T1XP。
嘗試'screen = pygame.display.set_mode(((682,415))''也許它你的傳球深度有問題。 – pmoleri 2013-05-03 14:28:43
您的桌面是否設置爲32位顏色深度?嘗試24位。嘗試閱讀[display.Info]的輸出(http://www.pygame.org/docs/ref/display.html#pygame.display.Info)。 – 9000 2013-05-03 14:29:28
深度?請解釋一下我在pygame的一個noob – user2344757 2013-05-03 14:29:49