def add_line(self, x1, y1, x2, y2, color, width, dasharray):
        connector = self.shapes.add_connector(MSO_CONNECTOR.STRAIGHT, Pt(x1),
                                              Pt(y1), Pt(x2), Pt(y2))
        connector.ln = connector.get_or_add_ln()
        line = LineFormat(connector)
        line.width = Pt(width)
        line.fill.solid()
        line.fill.fore_color.rgb = RGBColor(*color)

        if dasharray == 1:
            line.dash_style = MSO_LINE.SQUARE_DOT
        elif dasharray == 2:
            line.dash_style = MSO_LINE.DASH
示例#2
0
    def add_line(self, x1, y1, x2, y2, color, width, dasharray):
        connector = self.shapes.add_connector(MSO_CONNECTOR.STRAIGHT, Pt(x1),
                                              Pt(y1), Pt(x2), Pt(y2))
        connector.ln = connector.get_or_add_ln()
        line = LineFormat(connector)
        line.width = width
        line.fill.solid()

        if color == "black":
            line.fill.fore_color.rgb = RGBColor(0, 0, 0)
        elif color == "blue":
            line.fill.fore_color.rgb = RGBColor(0, 0, 255)

        if dasharray != "none":
            line.dash_style = MSO_LINE.DASH
示例#3
0
def get_line(color, connector, bright=None):
    try:
        colors_dict = {
            "Red": RGBColor(255, 0, 0),
            "Green": RGBColor(0, 255, 0),
            "Blue": RGBColor(0, 0, 255)
        }
        line = LineFormat(connector)
        line.fill.solid()
        line.fill.fore_color.rgb = colors_dict["{}".format(color)]
        if bright:
            line.color.brightness = 0.7
        else:
            line.color.brightness = 0.5
        line.width = Pt(7)
        return line.fill.fore_color.rgb
    except Exception as e:
        print(e)