马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
将鼠标移动到程序内#模块#
import pygame
import sys
from pygame.locals import *
#模块#
size = w,h = 600,400#设定背景长度
#初始化 pygame
pygame.init()
#创建指定大小的窗口
screen = pygame.display.set_mode(size)
#设置窗口标题
pygame.display.set_caption("第一个游戏")
#定义控制帧率
clock = pygame.time.Clock()
#鼠标修改#
a = pygame.cursors.Cursor()
thickarrow_strings = ( #sized 24x24
" ",
" ",
" ",
" ",
" ",
"XXXXXXX ",
"XXXXXXXX ",
"XX.....XX ",
"XX......XX ",
"XX.......XX ",
"XX........XX ",
"XX........XXX ",
"XX......XXXXX ",
"XX.XXX..XX ",
"XXXX XX..XX ",
"XX XX..XX ",
" XX..XX ",
" XX..XX ",
" XX..XX ",
" XXXX ",
" XX ",
" ",
" ",
" ")
c = pygame.cursors.compile(thickarrow_strings, black="X", white=".", xor="o")
a.type = "bitmap"
a.data = ((24,24),(11,2),*c)
pygame.mouse.set_cursor(a)
#鼠标修改#
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
screen.fill((255,255,255))#背景填充
#更新界面
pygame.display.flip()
#延时
clock.tick(50)#可修改
鼠标被改变了
发现光标对象使用方法的不容易
鼓励一下吧 |