如何使用 python 从另一个 window 读取文本

How to read text from another window with python

您好,我需要帮助才能实现这一目标,我已经查看了如下帖子: How to read text from balloon popup window using python? 但我没有成功。我太新了。

我实际需要的与此非常相似: )%3B%0A%20%7D

但是在python

试试这个:

import time
import win32gui

while True:
  window = win32gui.GetForegroundWindow()
  title = win32gui.GetWindowText(window)
  control = win32gui.FindWindowEx(window, 0, "static", None)
  print ' ', win32gui.GetWindowText(control)
  time.sleep(1)

来源:Get text from popup window