def due_picture(): data_list = db.run_query("due.sql") new_list = DueDate.time_converter(data_list) return_list = DueDate.make_dict(new_list) Graphics.setup(mode="RGBA", size=(1024, 1024), color=(255, 255, 255, 200)) Graphics.make_image(return_list, "due.png")
from PIL import ImageFont from PIL import Image from PIL import ImageDraw from datamanager import DataManager from graphics import Graphics from due import DueDate db = DataManager() db.create_tables("base_data.sql") data_list = db.run_query("due.sql") new_list = DueDate.time_converter(data_list) return_list = DueDate.make_dict(new_list) Graphics.setup(mode="RGB", size=(1024, 1024), color=(255, 255, 255)) Graphics.make_image(return_list, "due.png")
y += 100 font_size -= 10 text_options = { 'xy': (x, y), 'fill': text_color(row[1][1]), 'font': ImageFont.truetype("SourceSansPro-Regular.otf", font_size), 'text': row[1][0] } print(text_options) result.append(text_options) return result def text_color(hexa): try: value = hexa.lstrip('#') colors = [int(v, 16)*17 for v in (x for x in value)] RGB_list = (0, colors[0], colors[1], colors[2]) return RGB_list except AttributeError: RGB_list = (0, 255, 255, 255) return RGB_list Graphics.setup(mode="RGBA", size=(1024, 1024), color="white") Graphics.make_image(text_size(), "ooooooo.png")
def biggest_picture(): data_list = BiggestEurProjects('10-biggest-eur-projects-company.sql') return_list = data_list.text_size() Graphics.setup(mode="RGB", size=(1024, 1024), color="black") Graphics.make_image(return_list, "biggest-project.png") print(pict_ready)
def all_clients_picture(): clients_rgb = all_clients.hex_to_rgb(all_clients.clients, all_clients.clients_colors) all_clients.rgb_dic(clients_rgb) dic_list = all_clients.rgb_dic(clients_rgb) Graphics.setup(mode="RGB", size=(1024, 1024), color="black") Graphics.make_image(dic_list, 'all_clients.png')
def project_name_picture(): data_list = ProjctNumberRunner('project-names.sql') return_list = data_list.dict_to_image() Graphics.setup(mode="RGB", size=(1024, 1024), color="black") Graphics.make_image(return_list, "project-names.png") print(pict_ready)
return clients_rgb def rgb_dic(clients_rgb): name_list = [] dic_list = [] for i in clients_rgb: x = random.randint(0, 1024) y = random.randint(0, 1024) z = random.randint(15, 150) if i[0] not in name_list: name_list.append(i[0]) dic_list.append( { "xy": (x, y), "font": ImageFont.truetype("SourceSansPro-Regular.otf", y), "text": i[0], "fill": tuple(i[1]), } ) # print(dic_list) return dic_list clients_rgb = hex_to_rgb(clients, clients_colors) rgb_dic(clients_rgb) dic_list = rgb_dic(clients_rgb) Graphics.setup(mode="RGB", size=(1024, 1024), color="black") Graphics.make_image(dic_list, "all_clients.png")