-
Notifications
You must be signed in to change notification settings - Fork 2
/
index-ui.py
44 lines (37 loc) · 1.17 KB
/
index-ui.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from PIL import ImageGrab
import time
import threading
class ParentalControlApp:
def __init__(self):
self.is_running = False
self.thread = None
def take_screenshot(self):
timestamp = time.strftime("%Y-%m-%d_%H-%M-%S")
filename = "screenshot_{}.png".format(timestamp)
screenshot = ImageGrab.grab()
screenshot.save(filename)
print("Screenshot saved as {}".format(filename))
def take_screenshots(self):
while self.is_running:
self.take_screenshot()
time.sleep(5)
def start_screenshots(self):
self.is_running = True
self.thread = threading.Thread(target=self.take_screenshots)
self.thread.start()
print("Taking screenshots...")
def stop_screenshots(self):
self.is_running = False
self.thread.join()
print("Screenshot process stopped.")
def main():
app = ParentalControlApp()
try:
app.start_screenshots()
input("Press Enter to stop...")
app.stop_screenshots()
except KeyboardInterrupt:
app.stop_screenshots()
print("Program terminated by user")
if __name__ == "__main__":
main()