停止pygame更改光标

时间:2018-02-18 02:23:46

标签: python pygame cursor

如何通过pygame窗口阻止光标更改(或者等效地将光标设置为操作系统默认值)?

相关: Pygame change cursor to OS cursor

3 个答案:

答案 0 :(得分:0)

您需要获取os光标并将其转换为位图。 现在用 pygame.mouse.set_cursor(YOUR_CURSOR)

来源:http://www.pygame.org/docs/ref/cursors.html

答案 1 :(得分:0)

如果使用Windows 10,则可以使用以下方式模拟光标:

 cursor_text = (
 'X                       ',
 'XX                      ',
 'X.X                     ',
 'X..X                    ',
 'X...X                   ',
 'X....X                  ',
 'X.....X                 ',
 'X......X                ',
 'X.......X               ',
 'X........X              ',
 'X.........X             ',
 'X..........X            ',
 'X......XXXXX            ',
 'X...X..X                ',
 'X..X X..X               ',
 'X.X  X..X               ',
 'XX    X..X              ',
 '      X..X              ',
 '       XX               ',
 '                        ',
 '                        ',
 '                        ',
 '                        ',
 '                        ')
 cs, mask = pygame.cursors.compile(cursor_text)
 cursor = ((24, 24), (0, 0), cs, mask)
 pygame.mouse.set_cursor(*cursor)

答案 2 :(得分:0)

我不确定,但是可能是您的代码正在尝试更改光标。

在主循环的最后,输入以下代码。

pygame.mouse.set_system_cursor(pygame.SYSTEM_CURSOR_ARROW)

虽然可能是完全错误的。

相关问题