(self)
| 33 | self.checkTimer.start(10) # 10毫秒比较流畅 |
| 34 | |
| 35 | def checkWindow(self): |
| 36 | # 查找 |
| 37 | hwnd = win32gui.FindWindow('Notepad', None) |
| 38 | if self.tmpHwnd and not hwnd: |
| 39 | # 表示记事本关闭了 |
| 40 | self.checkTimer.stop() |
| 41 | self.close() # 关闭自己 |
| 42 | return |
| 43 | if not hwnd: |
| 44 | return |
| 45 | self.tmpHwnd = hwnd |
| 46 | # 获取位置 |
| 47 | rect = win32gui.GetWindowRect(hwnd) |
| 48 | print(rect) |
| 49 | self.move(rect[2], rect[1]) |
| 50 | |
| 51 | |
| 52 | if __name__ == '__main__': |