Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想用python for windows写一个时间跟踪软件。如何找到单个应用程序的总屏幕时间?是否有任何 Windows 服务可以跟踪特定应用程序在当前会话期间花费的总屏幕时间?还是有其他可以使用的方法?
也许 pywin32 是你要找的东西:
from win32gui import GetWindowText, GetForegroundWindow print(GetWindowText(GetForegroundWindow()))
您必须在后台反复运行并自己计算总屏幕时间。