-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathnovo.py
62 lines (58 loc) · 1.86 KB
/
novo.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
import keyboard
import tkinter
from tkinter import *
import tkinter.ttk
import threading
from tkinter.filedialog import (askopenfilename,
askopenfilenames,
askdirectory,
asksaveasfilename)
import tkinter.ttk
import time
global structureNumber
import pynput.mouse as pm
import threading
def on_click(x, y, button, pressed):
# 监听鼠标点击
if pressed:
print("按下坐标")
keyboard.press_and_release('ctrl+alt+.')
mxy="{},{}".format(x, y)
print(mxy)
print(button)
if not pressed:
# Stop listener
return False
def on_scroll(x, y, dx, dy):
if dy >0:
keyboard.press_and_release('ctrl+alt+.')
else:
keyboard.press_and_release('ctrl+alt+,')
def thread_recv():
global structureNumber
while(structureNumber):
with pm.Listener(on_click=on_click,
on_scroll=on_scroll
) as pmlistener:
pmlistener.join()
def Start():
global structureNumber
structureNumber =True
recv_data = threading.Thread(target=thread_recv)
recv_data.start()
def Stop():
global structureNumber
structureNumber =False
root =Tk()
root.title('NOVAL TEST v1.0.1')
button =Button(root, text="Start",command=Start,font=('微软雅黑',12),fg='green')
button.place(relx=0.1, rely=0.45, relwidth=0.3, relheight=0.15)
button =Button(root, text="Stop",command=Stop,font=('微软雅黑',12),fg='green')
button.place(relx=0.6, rely=0.45, relwidth=0.3, relheight=0.15)
screenwidth = root.winfo_screenwidth()
screenheight = root.winfo_screenheight()
size = '%dx%d+%d+%d' % (300, 200, (screenwidth - 300) / 2, (screenheight - 200) / 2)
root.geometry(size)
canvas = Canvas(root, width=200, height=100)
canvas.place(x=344,y=266)
root.mainloop()