make screenshots

This commit is contained in:
Alexander Popov 2022-12-26 21:39:58 +03:00
parent 0ea5e2da0e
commit 5e78ed790b

View File

@ -1,18 +1,30 @@
from datetime import datetime from datetime import datetime
import shutil
__author__ = "Alexander Popov <iiiypuk@fastmail.fm>" __author__ = "Alexander Popov <iiiypuk@fastmail.fm>"
__version__ = "1.0.0" __version__ = "1.0.0"
__license__ = "Unlicense" __license__ = "Unlicense"
def date_string(): def date_string(symbols=True):
"""Return current date.""" """Return current date."""
date_now = datetime.now() date_now = datetime.now()
if symbols:
date_str = date_now.strftime("%Y-%m-%d %H:%M:%S") date_str = date_now.strftime("%Y-%m-%d %H:%M:%S")
else:
date_str = date_now.strftime("%Y-%m-%d_%H_%M_%S")
return(date_str) return(date_str)
def make_screenshot():
"""..."""
image = capture(App.focusedWindow())
shutil.move(image, "{0}.png".format(date_string(False)))
def run_level(): def run_level():
"""Running level and farming apples""" """Running level and farming apples"""
@ -22,6 +34,8 @@ def run_level():
wait("images/level_title.png", 3) wait("images/level_title.png", 3)
click("images/level_start_button.png") click("images/level_start_button.png")
make_screenshot()
wait("images/equip_window.png", 3) wait("images/equip_window.png", 3)
click("images/button_start.png") click("images/button_start.png")