mouse_p_w_picpath_filename = 'fugu.png'
import pygame
from pygame.locals import *
from sys import exit
pygame.init()
screen = pygame.display.set_mode((640,480),0,32)
pygame.display.set_caption("Hello,World!")
##加载并转换图像
pygame.p_w_picpath.load(background_p_w_picpath_filename).convert()
mouse_cursor = pygame.p_w_picpath.load(mouse_p_w_picpath_filename).convert_alpha()
##游戏主循环
while True:
for event in pygame.event.get():
if event.type == QUIT:
exit() ##接收到退出事件后退出程序
screen.blit(background,(0,0))
##获得鼠标位置
x,y = pygame.mouse.get_pos()
##计算光标左上角位置
x -= mouse_cursor.get_width()/2
y -= mouse_cursor.get_height()/2
##把光标画上去
screen.blit(mouse_cursor,(x,y))
##刷新一下画面
pygame.display.update()