-3
import pygame, sys 
from pygame.locals import *

pygame.init() 
screen=pygame.display.set_mode((640,360),0,32) 

while True:     
    for event in pygame.event.get():        
        if event.type == QUIT:          
            pygame.quit()           
            sys.exit()          
        screen.lock()           
        pygame.draw.rect(screen, (140,240,130), Rect((100,100),(130,170)))
        screen.unlock()     
        pygame.display.update()

640x360 のウィンドウで retangle を表示することになっているのに、そうしないのです。なぜそうならないのか私にはわかりません。私を助けてください。

4

2 に答える 2

2

それは次のように機能します:

ここに画像の説明を入力

あなたは違う振る舞いをすることが期待されるかもしれませんか?

于 2013-04-28T06:45:53.713 に答える
0

次のコードはうまく機能します。

#!/usr/bin/python

import pygame, sys 
from pygame.locals import * 
pygame.init() 
screen = pygame.display.set_mode((640,360),0,32) 
while True:
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
            screen.lock()
            pygame.draw.rect(screen, (140,240,130), Rect((100,100),(130,170)))
            screen.unlock()     
pygame.display.update()

エラーに直面している場合は、エラーを共有してください。

于 2013-04-28T06:44:04.170 に答える