-
Notifications
You must be signed in to change notification settings - Fork 1
/
signal3.py
48 lines (38 loc) · 1.32 KB
/
signal3.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
#from pynput.keyboard import Listener
#from pynput.keyboard import Listener
from pynput import mouse
import traceback
#import pressKey
#import time
import configparser
def signal3(queue):
try:
def read_config(name):
config = configparser.ConfigParser()
config.read(name, encoding='utf-8')
conf = []
conf.append(config.get("Комбинации", "Оленемер мышь"))
return conf
conf = read_config("buttons.ini")
def on_click(x, y, button, pressed):
try:
if not pressed:
return
if button.name == conf[0]:
queue.put("parse")
except Exception as e:
file = open('error.log', 'a')
file.write('\n\n')
traceback.print_exc(file=file, chain=True)
traceback.print_exc()
file.close()
if conf[0]:
with mouse.Listener(on_click=on_click) as listener:
listener.join()
except Exception as e:
file = open('error.log', 'a')
file.write('\n\n')
traceback.print_exc(file=file, chain=True)
traceback.print_exc()
file.write(str(e))
file.close()