当前位置: 首页>>代码示例>>Python>>正文


Python colors.black方法代码示例

本文整理汇总了Python中reportlab.lib.colors.black方法的典型用法代码示例。如果您正苦于以下问题:Python colors.black方法的具体用法?Python colors.black怎么用?Python colors.black使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在reportlab.lib.colors的用法示例。


在下文中一共展示了colors.black方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: get_row_data

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def get_row_data(self, source, depth, row_idx):
        """
        Load the Matplotlib graph from the saved image, set its height and width
        and add it to the row.
        """
        header = self.get_header(source, depth, row_idx)
        styles = [
            RowStyle(
                font=(constants.FONT, constants.FONT_SIZE_SMALL),
                left_padding=constants.INDENT * (depth + 1),
                text_color=colors.black,
            )
        ]

        img = Image(source["source_path"])
        img.drawWidth = source["width"] * inch
        img.drawHeight = source["height"] * inch

        return header + RowData(
            content=[img, "", "", ""], start=header.end, style=styles
        ) 
开发者ID:Morgan-Stanley,项目名称:testplan,代码行数:23,代码来源:base.py

示例2: demo

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def demo(self):
        "Make sample legend."

        d = Drawing(200, 100)

        legend = Legend()
        legend.alignment = 'left'
        legend.x = 0
        legend.y = 100
        legend.dxTextSpace = 5
        items = 'red green blue yellow pink black white'.split()
        items = [(getattr(colors, i), i) for i in items]
        legend.colorNamePairs = items

        d.add(legend, 'legend')

        return d 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:19,代码来源:legends.py

示例3: sample1c

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def sample1c():
    "Make sample legend."

    d = Drawing(200, 100)

    legend = Legend()
    legend.alignment = 'right'
    legend.x = 0
    legend.y = 100
    legend.dxTextSpace = 5
    items = 'red green blue yellow pink black white'.split()
    items = [(getattr(colors, i), i) for i in items]
    legend.colorNamePairs = items

    d.add(legend, 'legend')

    return d 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:19,代码来源:legends.py

示例4: sample2c

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def sample2c():
    "Make sample legend."

    d = Drawing(200, 100)

    legend = Legend()
    legend.alignment = 'right'
    legend.x = 20
    legend.y = 90
    legend.deltax = 60
    legend.dxTextSpace = 10
    legend.columnMaximum = 4
    items = 'red green blue yellow pink black white'.split()
    items = [(getattr(colors, i), i) for i in items]
    legend.colorNamePairs = items

    d.add(legend, 'legend')

    return d 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:21,代码来源:legends.py

示例5: sample3

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def sample3():
    "Make sample legend with line swatches."

    d = Drawing(200, 100)

    legend = LineLegend()
    legend.alignment = 'right'
    legend.x = 20
    legend.y = 90
    legend.deltax = 60
    legend.dxTextSpace = 10
    legend.columnMaximum = 4
    items = 'red green blue yellow pink black white'.split()
    items = [(getattr(colors, i), i) for i in items]
    legend.colorNamePairs = items
    d.add(legend, 'legend')

    return d 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:20,代码来源:legends.py

示例6: sample3a

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def sample3a():
    "Make sample legend with line swatches and dasharrays on the lines."

    d = Drawing(200, 100)

    legend = LineLegend()
    legend.alignment = 'right'
    legend.x = 20
    legend.y = 90
    legend.deltax = 60
    legend.dxTextSpace = 10
    legend.columnMaximum = 4
    items = 'red green blue yellow pink black white'.split()
    darrays = ([2,1], [2,5], [2,2,5,5], [1,2,3,4], [4,2,3,4], [1,2,3,4,5,6], [1])
    cnp = []
    for i in range(0, len(items)):
        l =  LineSwatch()
        l.strokeColor = getattr(colors, items[i])
        l.strokeDashArray = darrays[i]
        cnp.append((l, items[i]))
    legend.colorNamePairs = cnp
    d.add(legend, 'legend')

    return d 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:26,代码来源:legends.py

示例7: sampleH5a

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def sampleH5a():
    "A simple bar chart with no expressed spacing attributes."

    drawing = Drawing(400, 200)

    data = dataSample5

    bc = HorizontalBarChart()
    bc.x = 50
    bc.y = 50
    bc.height = 125
    bc.width = 300
    bc.data = data
    bc.strokeColor = colors.black

    bc.valueAxis.valueMin = 0
    bc.valueAxis.valueMax = 60
    bc.valueAxis.valueStep = 15

    bc.categoryAxis.labels.boxAnchor = 'e'
    bc.categoryAxis.categoryNames = ['Ying', 'Yang']

    drawing.add(bc)

    return drawing 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:27,代码来源:barcharts.py

示例8: demo

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def demo(self):
        D = Drawing(200, 100)
        name = self.availableFlagNames()
        import time
        name = name[int(time.time()) % len(name)]
        fx = Flag()
        fx.kind = name
        fx.x = 0
        fx.y = 0
        D.add(fx)
        labelFontSize = 10
        D.add(String(fx.x+(fx.size/2.0),(fx.y-(1.2*labelFontSize)),
                            name, fillColor=colors.black, textAnchor='middle',
                            fontSize=labelFontSize))
        labelFontSize = int(fx.size/4.0)
        D.add(String(fx.x+(fx.size),(fx.y+((fx.size/2.0))),
                            "SAMPLE", fillColor=colors.gold, textAnchor='middle',
                            fontSize=labelFontSize, fontName="Helvetica-Bold"))
        return D 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:21,代码来源:flags.py

示例9: _Flag_Afghanistan

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def _Flag_Afghanistan(self):
        s = _size
        g = Group()

        box = Rect(0, 0, s*2, s,
            fillColor = colors.mintcream, strokeColor = colors.black, strokeWidth=0)
        g.add(box)

        greenbox = Rect(0, ((s/3.0)*2.0), width=s*2.0, height=s/3.0,
                fillColor = colors.limegreen, strokeColor = None, strokeWidth=0)
        g.add(greenbox)

        blackbox = Rect(0, 0, width=s*2.0, height=s/3.0,
                fillColor = colors.black, strokeColor = None, strokeWidth=0)
        g.add(blackbox)
        return g 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:18,代码来源:flags.py

示例10: _Flag_Austria

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def _Flag_Austria(self):
        s = _size  # abbreviate as we will use this a lot
        g = Group()

        box = Rect(0, 0, s*2, s, fillColor = colors.mintcream,
            strokeColor = colors.black, strokeWidth=0)
        g.add(box)


        redbox1 = Rect(0, 0, width=s*2.0, height=s/3.0,
            fillColor = colors.red, strokeColor = None, strokeWidth=0)
        g.add(redbox1)

        redbox2 = Rect(0, ((s/3.0)*2.0), width=s*2.0, height=s/3.0,
            fillColor = colors.red, strokeColor = None, strokeWidth=0)
        g.add(redbox2)
        return g 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:19,代码来源:flags.py

示例11: _Flag_Belgium

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def _Flag_Belgium(self):
        s = _size
        g = Group()

        box = Rect(0, 0, s*2, s,
            fillColor = colors.black, strokeColor = colors.black, strokeWidth=0)
        g.add(box)


        box1 = Rect(0, 0, width=(s/3.0)*2.0, height=s,
            fillColor = colors.black, strokeColor = None, strokeWidth=0)
        g.add(box1)

        box2 = Rect(((s/3.0)*2.0), 0, width=(s/3.0)*2.0, height=s,
            fillColor = colors.gold, strokeColor = None, strokeWidth=0)
        g.add(box2)

        box3 = Rect(((s/3.0)*4.0), 0, width=(s/3.0)*2.0, height=s,
            fillColor = colors.red, strokeColor = None, strokeWidth=0)
        g.add(box3)
        return g 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:23,代码来源:flags.py

示例12: _initialize_document

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def _initialize_document(self):
        # initialize the pdf file (based on layout of pieces)
        self._doc = self._doc_cls(self._file_path)
        self._doc.setPageSize([self._doc_size['w']*mm, self._doc_size['h']*mm])
        self._doc.setAuthor(boxmaker.APP_NAME+" "+boxmaker.APP_VERSION)
        self._doc.setStrokeColor(black)
        self._doc.setLineWidth(0.1)
        # print out some summary info for good record keeping purposes
        self._doc.drawString(15*mm, 35*mm, "Cut Width: %.4fmm" % self._cut_width)
        self._doc.drawString(15*mm, 30*mm, "Material Thickness: %.4fmm" % self._thickness)
        self._doc.drawString(15*mm, 25*mm, "W x D x H: %.2fmm x %.2fmm x %.2fmm" %
                             (self._size['w'], self._size['d'], self._size['h']))
        self._doc.drawString(15*mm, 20*mm, "Produced by "+boxmaker.APP_NAME+" v"+boxmaker.APP_VERSION +
                             " on "+time.strftime("%m/%d/%Y")+" at "+time.strftime("%H:%M:%S"))
        self._doc.drawString(15*mm, 15*mm, boxmaker.WEBSITE_URL) 
开发者ID:rahulbot,项目名称:box-designer-website,代码行数:17,代码来源:box.py

示例13: add_section_sequences

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def add_section_sequences(self, plots=[], stats=None):
        section = self.get_section_number()
        subsection = itertools.count(1)
        if stats is not None:
            self.story.append(Paragraph("{:d} Basecalling".format(section), self.heading_style))
            self.story.append(Spacer(1, 0))
            self.story.append(Paragraph("{:d}.{:d} Summary".format(section, next(subsection)), self.heading2_style))
            #['Tag', 'Basecalling', 'Sum', 'Mean', 'Median', 'N50', 'Maximum']
            header = ['', ''] + list(stats.columns.values[2:])
            table_data = [header] + [[y if isinstance(y, str) else '{:.0f}'.format(y) for y in x] for x in stats.values]
            table_style = [ ('FONTSIZE', (0,0), (-1, -1), 10),
                            ('LINEABOVE', (0,1), (-1,1), 0.5, colors.black),
                            ('LINEBEFORE', (2,0), (2,-1), 0.5, colors.black),
                            ('ALIGN', (0,0), (1,-1), 'LEFT'),
                            ('ALIGN', (2,0), (-1,-1), 'RIGHT')]
            self.story.append(Table(table_data, style=table_style))
            self.story.append(Spacer(1, 0))
        for key, group in itertools.groupby(plots, lambda x : x[1].basecalling):
            self.story.append(Paragraph('{:d}.{:d} {}:'.format(section, next(subsection), key.capitalize()), self.heading2_style))
            for plot_file, plot_wildcards in sorted(list(group), key=lambda x : x[1].i):
                im = svg2rlg(plot_file)
                im = Image(im, width=im.width * self.plot_scale, height=im.height * self.plot_scale)
                im.hAlign = 'CENTER'
                self.story.append(im)
                self.story.append(Spacer(1, 0))
        self.story.append(Spacer(1, 0.5*cm)) 
开发者ID:giesselmann,项目名称:nanopype,代码行数:28,代码来源:report.py

示例14: table_model

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def table_model():
    """
    添加表格
    :return:
    """
    template_path = current_app.config.get("REPORT_TEMPLATES")
    image_path = os.path.join(template_path, 'test.jpg')
    new_img = Image(image_path, width=300, height=300)
    base = [
        [new_img, ""],
        ["大类", "小类"],
        ["WebFramework", "django"],
        ["", "flask"],
        ["", "web.py"],
        ["", "tornado"],
        ["Office", "xlsxwriter"],
        ["", "openpyxl"],
        ["", "xlrd"],
        ["", "xlwt"],
        ["", "python-docx"],
        ["", "docxtpl"],
    ]

    style = [
        # 设置字体
        ('FONTNAME', (0, 0), (-1, -1), 'SimSun'),

        # 合并单元格 (列,行)
        ('SPAN', (0, 0), (1, 0)),
        ('SPAN', (0, 2), (0, 5)),
        ('SPAN', (0, 6), (0, 11)),

        # 单元格背景
        ('BACKGROUND', (0, 1), (1, 1), HexColor('#548DD4')),

        # 字体颜色
        ('TEXTCOLOR', (0, 1), (1, 1), colors.white),
        # 对齐设置
        ('VALIGN', (0, 0), (-1, -1), 'MIDDLE'),
        ('ALIGN', (0, 0), (-1, -1), 'CENTER'),

        # 单元格框线
        ('GRID', (0, 0), (-1, -1), 0.5, colors.grey),
        ('BOX', (0, 0), (-1, -1), 0.5, colors.black),

    ]

    component_table = Table(base, style=style)
    return component_table 
开发者ID:qzq1111,项目名称:flask-restful-example,代码行数:51,代码来源:report.py

示例15: add_table

# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import black [as 别名]
def add_table(self, data):
        t = Table(data)
        t.setStyle(TableStyle([('TEXTCOLOR', (0, 0), (1, -1), colors.black),]))
        self.f.append(t) 
开发者ID:yarox24,项目名称:attack_monitor,代码行数:6,代码来源:reporting.py


注:本文中的reportlab.lib.colors.black方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。