私はPyGameに比較的慣れていません。画面上のマウスの位置を示す文字列を表示する簡単なプログラムを作成しようとしています。
import pygame, sys
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((400,400),0,32)
myFont = pygame.font.SysFont('arial', 14)
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
x,y = pygame.mouse.get_pos()
label = myFont.render('mouse coords: ' + str(x) + ', ' + str(y), 1, (0,128,255))
screen.blit(label, (10,10))
pygame.display.update()
マウスを動かすと、テキストが読めなくなるまでラベルがぼやけます。screen.blit() と pygame.display.update() を正しく呼び出していると確信していますが、ラベルが更新されていないようです! どんな助けでも素晴らしいでしょう。