sydomain

思绪来的快,去的也快,偶尔在这里停留。

唤醒微信并获取当前微信位置坐标以及高度宽度

# 模拟按下和松开Win键,以唤起微信
pyautogui.hotkey("ctrl", "alt", "w")
time.sleep(2)  # 等待微信窗口出现

# 获取微信窗口的位置和大小
wechat_window = pyautogui.getWindowsWithTitle("微信")[0]
wechat_window_x, wechat_window_y, wechat_window_width, wechat_window_height = wechat_window.left, wechat_window.top, wechat_window.width, wechat_window.height


# 打印微信窗口的位置和大小
print("微信窗口位置:({}, {})".format(wechat_window_x, wechat_window_y))
print("微信窗口大小:{} x {}".format(wechat_window_width, wechat_window_height))

# 等待一段时间,以便观察效果
time.sleep(5)


Powered By sydomain

Copyright Your WebSite.Some Rights Reserved.