-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsouris.py
65 lines (61 loc) · 1.98 KB
/
souris.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import pygame
from pygame.locals import *
souris = ( " ",
"XXXXXXXXXXXXXXXXXXXXXXXX",
"X......................X",
"X......................X",
"X......................X",
"X....XXX........XXX....X",
"X....X.X........X.X....X",
"X....XXX........XXX....X",
"X......................X",
"X......................X",
"X......................X",
"X..........XXX.........X",
"X..........XXX.........X",
"X..........XXX.........X",
"X......................X",
"X......................X",
"X......................X",
"X.....X..........X.....X",
"X.....X..........X.....X",
"X.....XXXXXXXXXXXX.....X",
"X......................X",
"X......................X",
"XXXXXXXXXXXXXXXXXXXXXXXX",
" ")
def Test(souris):
hotspot = None
y = 1
for y in range(len(souris)):
for x in range(len(souris[y])):
if souris[y][x] in ['x', ',', '.']:
hotspot = x,y
break
if hotspot != None:
break
if hotspot == None:
raise Exception("No hotspot specified for cursor '%s'!" %
cursorname)
s2 = []
for ligne in souris:
s2.append(ligne.replace('x', 'X').replace(',', '.').replace('O',
'o'))
curseur, masque = pygame.cursors.compile(s2, 'X', '.', 'o')
taille = len(souris[0]), len(souris)
pygame.mouse.set_cursor(taille, hotspot, curseur, masque)
def main():
pygame.init()
pygame.font.init()
font = pygame.font.Font(None, 24)
bg = pygame.display.set_mode((800, 600), 0, 24)
pygame.display.update()
for curseur in [souris]:
Test(curseur)
marche = True
if marche:
pygame.event.pump()
for event in pygame.event.get():
if event.type == QUIT:
marche = False
main()