def create_screenshot(name, data, path, font, is_module):
desktop_color = get_color_for_name(name)<EOL>if is_module:<EOL><INDENT>data.append(<EOL>{"<STR_LIT>": name.split("<STR_LIT:->")[<NUM_LIT:0>], "<STR_LIT>": desktop_color, "<STR_LIT>": True}<EOL>)<EOL>data.append(<EOL>{"<STR_LIT>": "<STR_LIT>", "<STR_LIT>": COLOR_PY3STATUS, "<STR_LIT>": True}<EOL>)<EOL><DEDENT>img = Image.new("<STR_LIT>", (WIDTH, HEIGHT), COLOR_BG)<EOL>d = ImageDraw.Draw(img)<EOL>d.rectangle((<NUM_LIT:0>, <NUM_LIT:0>, WIDTH, TOP_BAR_HEIGHT), fill=desktop_color)<EOL>x = X_OFFSET<EOL>for part in reversed(data):<EOL><INDENT>text = part.get("<STR_LIT>")<EOL>color = part.get("<STR_LIT>", COLOR)<EOL>background = part.get("<STR_LIT>")<EOL>separator = part.get("<STR_LIT>")<EOL>urgent = part.get("<STR_LIT>")<EOL>if urgent:<EOL><INDENT>color = COLOR_URGENT<EOL>background = COLOR_URGENT_BG<EOL><DEDENT>size = font.getsize(text)<EOL>if background:<EOL><INDENT>d.rectangle(<EOL>(<EOL>WIDTH - x - (size[<NUM_LIT:0>] // SCALE),<EOL>TOP_BAR_HEIGHT + PADDING,<EOL>WIDTH - x - <NUM_LIT:1>,<EOL>HEIGHT - PADDING,<EOL>),<EOL>fill=background,<EOL>)<EOL><DEDENT>x += size[<NUM_LIT:0>] // SCALE<EOL>txt = Image.new("<STR_LIT>", size, background or COLOR_BG)<EOL>d_text = ImageDraw.Draw(txt)<EOL>d_text.text((<NUM_LIT:0>, <NUM_LIT:0>), text, font=font, fill=color)<EOL>txt = txt.resize((size[<NUM_LIT:0>] // SCALE, size[<NUM_LIT:1>] // SCALE), Image.ANTIALIAS)<EOL>img.paste(txt, (WIDTH - x, TOP_BAR_HEIGHT + PADDING))<EOL>if separator:<EOL><INDENT>x += SEP_PADDING_RIGHT<EOL>d.line(<EOL>(<EOL>(WIDTH - x, TOP_BAR_HEIGHT + PADDING),<EOL>(WIDTH - x, TOP_BAR_HEIGHT + <NUM_LIT:1> + PADDING + FONT_SIZE),<EOL>),<EOL>fill=COLOR_SEP,<EOL>width=<NUM_LIT:1>,<EOL>)<EOL>x += SEP_PADDING_LEFT<EOL><DEDENT><DEDENT>img.save(os.path.join(path, "<STR_LIT>" % name))<EOL>print("<STR_LIT>" % name)<EOL>
Create screenshot of py3status output and save to path