def screenshots(self): ''' Take screenshots of all the pages in sitemap. ''' if not os.path.exists(Sitemap.screenshot_dir): os.makedirs(Sitemap.screenshot_dir) cookies_list = [] for (key, value) in self.cookies.items(): cookies_list.append(key + '=' + value) urls = [] for url in self.sitemap.keys(): if not self.skipscreenshot \ or self.skipscreenshot not in url: urls.append(url) self.sitemap[url]['image'] = os.path.join( Sitemap.screenshot_dir, url.pretty() + '.png') screenshot = Screenshot(path=Sitemap.screenshot_dir) screenshot.screenshot(urls, cookies_list)
from control import patterns_overlap, determine_next_basket_position from mouse import shoot, click_play_again from debug import draw_trajectory, draw_ball, draw_basket, display_image """ General TODOs """ # TODO: basket is found as (x, y) instead of (y, x) # TODO: logging # TODO: learn how to write python documentation # TODO: important comment should be in docstrings and not as comments # TODO: consistent use of ints for data storage # how much to sleep between two consecutive measurements if __name__ == '__main__': s = Screenshot() screen_and_crop = lambda: crop_game_area(s.screenshot()) shots_hit = 0 pattern_length = 10 measurement_interval = 0 # shooting loop while True: trajectory = [] # record the beggining of the pattern first_pattern = [] for _ in xrange(0, pattern_length): img_screen = screen_and_crop() measurement = find_basket(img_screen)