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
| left = 2560 // 2 top = 1600 // 2 width = 2560 // 2 w = 2560 // 5 h = 1600 // 5
""" 可以用这个命令去获取当前屏幕分辨率 root = tk.Tk() width = root.winfo_screenwidth() height = root.winfo_screenheight() """ window_name = 'output' sct = mss.mss() monitor = { "left": left, 'top': top, 'width': width, 'height': height }
while True: img = sct.grab(monitor) img = np.array(img) cv2.resizeWindow(window_name, w, h) cv2.imshow(window_name, img)
k = cv2.waitKey(250) hwnd = win32gui.FindWindow(None, window_name) win32gui.SetWindowPos(hwnd, win32con.HWND_TOPMOST, 0, 0, 0, 0, win32con.SWP_NOMOVE | win32con.SWP_NOSIZE) if k % 256 == 27: exit(0)
|