'How to record screentime of windows in tkinter?

I want to create a desktop application which records your screentime and gives you notification after a specific duration like an alarm,but i can't figure out how do i record screentime in tkinter...I'm a newbie in python.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source