-
Notifications
You must be signed in to change notification settings - Fork 0
/
свой курсор мыши.py
38 lines (33 loc) · 982 Bytes
/
свой курсор мыши.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
import pygame
import os
pygame.init()
x, y = 300, 300
size = width, height = x, y
screen = pygame.display.set_mode(size)
screen.fill((0, 0, 0))
def load_image(name, colorkey=None):
fullname = os.path.join('data', name)
try:
image = pygame.image.load(fullname)
except pygame.error as message:
print('Cannot load image:', name)
raise SystemExit(message)
image = image.convert_alpha()
if colorkey is not None:
if colorkey is -1:
colorkey = image.get_at((0, 0))
image.set_colorkey(colorkey)
return image
img = load_image('arrow.png')
running = True
pygame.mouse.set_visible(False)
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
quit()
if event.type == pygame.MOUSEMOTION:
pos = event.pos
screen.fill((0, 0, 0))
if pygame.mouse.get_focused():
screen.blit(img, pos)
pygame.display.flip()