-
Notifications
You must be signed in to change notification settings - Fork 0
/
note.txt
32 lines (25 loc) · 969 Bytes
/
note.txt
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
#config git
cd documents/xcolorpick
git remote add origin https://gitee.com/xsencer/xcolorpick.git
git clone https://gitee.com/xsencer/xcolorpick.git
#create python code with ui
cd documents/xcolorpick
pyuic5 -o frame.py frame.ui
#get windows ID list
import win32gui
hwnd_title = dict()
def get_all_hwnd(hwnd,mouse):
if win32gui.IsWindow(hwnd) and win32gui.IsWindowEnabled(hwnd) and win32gui.IsWindowVisible(hwnd):
hwnd_title.update({hwnd:win32gui.GetWindowText(hwnd)})
win32gui.EnumWindows(get_all_hwnd, 0)
for h,t in hwnd_title.items():
if t is not "":
print(h,t)
#get and save screen shot
def grab_screen():
m = mouse.Mouse()
pos = m.get_mouse_pos()
print(pos)
img = screen.grabWindow(QtWidgets.QApplication.desktop().winId(),pos[0],pos[1],32,32)
img.save(os.path.abspath(os.path.dirname(__file__)) + "\shot.jpg")
ui.label_2.setPixmap(QtGui.QPixmap(os.path.abspath(os.path.dirname(__file__)) + "\shot.jpg"))