也许pywin32是你要找的:
from win32gui import GetWindowText, GetForegroundWindow print(GetWindowText(GetForegroundWindow()))
你必须在后台重复运行并自己计算总屏幕时间。