2
Contributors
2
Replies
4
Views
9 Years
Discussion Span
Last Post by besktrap
0

Here is an example ...

# PyGame example of how to change the mouse cursor

import pygame as pg

bgcolor = 255, 255, 255  # white

screen = pg.display.set_mode((600, 300))
pg.display.set_caption('testing a different cursor')
screen.fill(bgcolor)

# set the mouse cursor
# you can replace diamond with arrow, ball, broken_x, tri_left, tri_right
#pg.mouse.set_cursor(*pg.cursors.diamond)
pg.mouse.set_cursor(*pg.cursors.tri_right)

# you can print the tuples associated with a certain cursor
# if you can make any sense of it, then you can customize it
print pg.cursors.arrow
"""
output -->
((16, 16), (0, 0), (0, 0, 64, 0, 96, 0, 112, 0, 120, 0, 124, 0, 126,
0, 127, 0, 127, 128, 124, 0, 108, 0, 70, 0, 6, 0, 3, 0, 3, 0, 0, 0),
(64, 0, 224, 0, 240, 0, 248, 0, 252, 0, 254, 0, 255, 0, 255, 128, 255,
192, 255, 128, 254, 0, 239, 0, 79, 0, 7, 128, 7, 128, 3, 0))
"""

pg.display.flip()

# set up the event loop ...
running = True
while running:
    event = pg.event.poll()
    # quit when window corner x is clicked
    if event.type == pg.QUIT:
        running = False
0

thanks,but I meant actually setting an image for the cursor, life "mouse.bmp" or something like that

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.