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


Python Rect.strokeColor方法代码示例

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


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

示例1: makeInnerTiles

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
    def makeInnerTiles(self):
        # inner grid lines
        group = Group()

        w, h = self.width, self.height

        # inner grid stripes (solid rectangles)
        if self.useRects == 1:
            cols = self.stripeColors

            if self.orientation == 'vertical':
                r = self.makeLinePosList(self.x, isX=1)
            elif self.orientation == 'horizontal':
                r = self.makeLinePosList(self.y, isX=0)

            dist = makeDistancesList(r)

            i = 0
            for j in range(len(dist)):
                if self.orientation == 'vertical':
                    x = r[j]
                    stripe = Rect(x, self.y, dist[j], h)
                elif self.orientation == 'horizontal':
                    y = r[j]
                    stripe = Rect(self.x, y, w, dist[j])
                stripe.fillColor = cols[i % len(cols)]
                stripe.strokeColor = None
                group.add(stripe)
                i = i + 1

        return group
开发者ID:halimath,项目名称:taskcardmaker,代码行数:33,代码来源:grids.py

示例2: _draw_segment

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
    def _draw_segment(self, cur_drawing):
        """Draw the current chromosome segment.
        """
        # set the coordinates of the segment -- it'll take up the MIDDLE part
        # of the space we have.
        segment_y = self.end_y_position
        segment_width = (self.end_x_position - self.start_x_position) \
                        * self.chr_percent
        segment_height = self.start_y_position - self.end_y_position
        segment_x = self.start_x_position \
                  + 0.5 * (self.end_x_position - self.start_x_position - segment_width)

        # first draw the sides of the segment
        right_line = Line(segment_x, segment_y,
                          segment_x, segment_y + segment_height)
        left_line = Line(segment_x + segment_width, segment_y,
                         segment_x + segment_width, segment_y + segment_height)

        cur_drawing.add(right_line)
        cur_drawing.add(left_line)

        # now draw the box, if it is filled in
        if self.fill_color is not None:
            fill_rectangle = Rect(segment_x, segment_y,
                                  segment_width, segment_height)
            fill_rectangle.fillColor = self.fill_color
            fill_rectangle.strokeColor = None

            cur_drawing.add(fill_rectangle)
开发者ID:sip958,项目名称:biopython,代码行数:31,代码来源:BasicChromosome.py

示例3: create_header

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
    def create_header(self):
        headerCanvas = Drawing()
        headerRect = Rect(0, 0, width=self.width, height=50)
        headerRect.fillColor = HexColor("#607D8B")
        headerRect.strokeColor = HexColor("#607D8B")
        headerCanvas.add(headerRect)
        renderPDF.draw(headerCanvas, self.c, 0, self.height - 50)

        _header_styles = ParagraphStyle(
            "Header",
            parent=self.styles["Heading1"],
            textColor=white,
            fontName='Helvetica'
        )
        p = Paragraph("Kit Trading Fund Report", style = _header_styles)

        p.wrapOn(self.c, self.width, self.height - 50)
        p.drawOn(self.c, *self.coord(75, 10, mm))

        _sub_header_styles = ParagraphStyle(
            "SubHeader",
            parent=self.styles["Heading4"],
            textColor=white,
            fontName='Helvetica'
        )
        p = Paragraph("Monthly Report: January 2016", style = _sub_header_styles)
        p.wrapOn(self.c, self.width, self.height - 50)
        p.drawOn(self.c, *self.coord(85, 16, mm))
开发者ID:denisvolokh,项目名称:reportlab-report-prototype,代码行数:30,代码来源:main2.py

示例4: _draw_square

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
 def _draw_square(self, color):
     "draws a square"
     square = Drawing(5, 5)
     sqr = Rect(0, 2.5, 5, 5)
     sqr.fillColor = color
     sqr.strokeColor = color
     square.add(sqr)
     return square
开发者ID:aureg,项目名称:baruwa2,代码行数:10,代码来源:graphs.py

示例5: makeFilledSquare

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
def makeFilledSquare(x, y, size, color):
    "Make a filled square marker."

    d = size/2.0
    rect = Rect(x-d, y-d, 2*d, 2*d)
    rect.strokeColor = color
    rect.fillColor = color

    return rect
开发者ID:Dongminator,项目名称:CV-Management-tool,代码行数:11,代码来源:markers.py

示例6: makeEmptySquare

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
def makeEmptySquare(x, y, size, color):
    "Make an empty square marker."

    d = size/2.0
    rect = Rect(x-d, y-d, 2*d, 2*d)
    rect.strokeColor = color
    rect.fillColor = None

    return rect
开发者ID:Dongminator,项目名称:CV-Management-tool,代码行数:11,代码来源:markers.py

示例7: makeOuterRect

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
 def makeOuterRect(self):
     strokeColor = getattr(self,'rectStrokeColor',self.strokeColor)
     strokeWidth = getattr(self,'rectStrokeWidth',self.strokeWidth)
     if self.fillColor or (strokeColor and strokeWidth):
         rect = Rect(self.x, self.y, self.width, self.height)
         rect.fillColor = self.fillColor
         rect.strokeColor = strokeColor
         rect.strokeWidth = strokeWidth
         return rect
     else:
         return None
开发者ID:halimath,项目名称:taskcardmaker,代码行数:13,代码来源:grids.py

示例8: draw_square

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
def draw_square(color):
    "draws a square"
    from reportlab.graphics.shapes import Rect
    from reportlab.graphics.shapes import Drawing

    square = Drawing(5, 5)
    sqr = Rect(0, 2.5, 5, 5)
    sqr.fillColor = color
    sqr.strokeColor = color
    square.add(sqr)
    return square
开发者ID:sandroden,项目名称:baruwa,代码行数:13,代码来源:sendpdfreports.py

示例9: draw

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
    def draw(self):
        # general widget bits
        group = Group()
        x, y, w, h, c0, c1 = self._flipRectCorners()
        numShades = self.numShades
        if self.cylinderMode:
            if not numShades % 2: numShades = numShades + 1
            halfNumShades = (numShades - 1) / 2 + 1
        num = float(numShades)  # must make it float!
        vertical = self.orientation == 'vertical'
        if vertical:
            if numShades == 1:
                V = [x]
            else:
                V = frange(x, x + w, w / num)
        else:
            if numShades == 1:
                V = [y]
            else:
                V = frange(y, y + h, h / num)

        for v in V:
            stripe = vertical and Rect(v, y, w / num, h) or Rect(
                x, v, w, h / num)
            if self.cylinderMode:
                if V.index(v) >= halfNumShades:
                    col = colors.linearlyInterpolatedColor(
                        c1, c0, V[halfNumShades], V[-1], v)
                else:
                    col = colors.linearlyInterpolatedColor(
                        c0, c1, V[0], V[halfNumShades], v)
            else:
                col = colors.linearlyInterpolatedColor(c0, c1, V[0], V[-1], v)
            stripe.fillColor = col
            stripe.strokeColor = col
            stripe.strokeWidth = 1
            group.add(stripe)
        if self.strokeColor and self.strokeWidth >= 0:
            rect = Rect(x, y, w, h)
            rect.strokeColor = self.strokeColor
            rect.strokeWidth = self.strokeWidth
            rect.fillColor = None
            group.add(rect)
        return group
开发者ID:radical-software,项目名称:radicalspam,代码行数:46,代码来源:grids.py

示例10: create_performance_chart_header

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
    def create_performance_chart_header(self):
        _width = self.width
        _height = 20
        headerCanvas = Drawing()
        headerRect = Rect(0, 0, width = _width, height = _height)
        headerRect.fillColor = HexColor("#607D8B")
        headerRect.strokeColor = HexColor("#607D8B")
        headerCanvas.add(headerRect)
        renderPDF.draw(headerCanvas, self.c, 0, self.height - 217)

        _summary_styles = ParagraphStyle(
            "PERFORMANCE CHART",
            parent=self.styles["Heading5"],
            textColor=white,
            fontName='Helvetica'
        )
        p = Paragraph("PERFORMANCE", style = _summary_styles)
        p.wrapOn(self.c, _width, _height)
        p.drawOn(self.c, *self.coord(4, 75, mm))
开发者ID:denisvolokh,项目名称:reportlab-report-prototype,代码行数:21,代码来源:main2.py

示例11: create_risk_header

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
    def create_risk_header(self):
        _width = self.width / 2 - 10
        _height = 20
        headerCanvas = Drawing()
        headerRect = Rect(0, 0, width = _width, height = _height)
        headerRect.fillColor = HexColor("#607D8B")
        headerRect.strokeColor = HexColor("#607D8B")
        headerCanvas.add(headerRect)
        renderPDF.draw(headerCanvas, self.c, x = _width + 20, y = self.height - 75)

        _summary_styles = ParagraphStyle(
            "RISKS",
            parent=self.styles["Heading5"],
            textColor=white,
            fontName='Helvetica'
        )
        p = Paragraph("RISKS", style = _summary_styles)
        p.wrapOn(self.c, _width, _height)
        p.drawOn(self.c, *self.coord(115, 25, mm))
开发者ID:denisvolokh,项目名称:reportlab-report-prototype,代码行数:21,代码来源:main2.py

示例12: _overdraw_subcomponents

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
    def _overdraw_subcomponents(self, cur_drawing):
        """Draw any annotated features on the chromosome segment.

        Assumes _draw_segment already called to fill out the basic shape,
        and assmes that uses the same boundaries.
        """
        # set the coordinates of the segment -- it'll take up the MIDDLE part
        # of the space we have.
        segment_y = self.end_y_position
        segment_width = (self.end_x_position - self.start_x_position) \
                        * self.chr_percent
        label_sep = (self.end_x_position - self.start_x_position) \
                        * self.label_sep_percent
        segment_height = self.start_y_position - self.end_y_position
        segment_x = self.start_x_position \
                  + 0.5 * (self.end_x_position - self.start_x_position - segment_width)

        left_labels = []
        right_labels = []
        for f in self.features:
            try:
                # Assume SeqFeature objects
                start = f.location.start
                end = f.location.end
                strand = f.strand
                try:
                    # Handles Artemis colour integers, HTML colors, etc
                    color = _color_trans.translate(f.qualifiers['color'][0])
                except Exception:  # TODO: ValueError?
                    color = self.default_feature_color
                fill_color = color
                name = ""
                for qualifier in self.name_qualifiers:
                    if qualifier in f.qualifiers:
                        name = f.qualifiers[qualifier][0]
                        break
            except AttributeError:
                # Assume tuple of ints, string, and color
                start, end, strand, name, color = f[:5]
                color = _color_trans.translate(color)
                if len(f) > 5:
                    fill_color = _color_trans.translate(f[5])
                else:
                    fill_color = color
            assert 0 <= start <= end <= self.bp_length
            if strand == +1:
                # Right side only
                x = segment_x + segment_width * 0.6
                w = segment_width * 0.4
            elif strand == -1:
                # Left side only
                x = segment_x
                w = segment_width * 0.4
            else:
                # Both or neither - full width
                x = segment_x
                w = segment_width
            local_scale = segment_height / self.bp_length
            fill_rectangle = Rect(x, segment_y + segment_height - local_scale * start,
                                  w, local_scale * (start - end))
            fill_rectangle.fillColor = fill_color
            fill_rectangle.strokeColor = color
            cur_drawing.add(fill_rectangle)
            if name:
                if fill_color == color:
                    back_color = None
                else:
                    back_color = fill_color
                value = (segment_y + segment_height - local_scale * start, color, back_color, name)
                if strand == -1:
                    self._left_labels.append(value)
                else:
                    self._right_labels.append(value)
开发者ID:sip958,项目名称:biopython,代码行数:75,代码来源:BasicChromosome.py

示例13: draw

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
    def draw(self):
        g = Group()
        colorNamePairs = self.colorNamePairs
        thisx = upperleftx = self.x
        thisy = upperlefty = self.y - self.dy
        dx, dy, alignment, columnMaximum = self.dx, self.dy, self.alignment, self.columnMaximum
        deltax, deltay, dxTextSpace = self.deltax, self.deltay, self.dxTextSpace
        fontName, fontSize, fillColor = self.fontName, self.fontSize, self.fillColor
        strokeWidth, strokeColor = self.strokeWidth, self.strokeColor
        leading = fontSize*1.2
        if not deltay:
            deltay = max(dy,leading)+self.autoYPadding
        if not deltax:
            maxWidth = self._calculateMaxWidth(colorNamePairs)
            deltax = maxWidth+dx+dxTextSpace+self.autoXPadding
        else:
            if alignment=='left': maxWidth = self._calculateMaxWidth(colorNamePairs)

        def gAdd(t,g=g,fontName=fontName,fontSize=fontSize,fillColor=fillColor):
            t.fontName = fontName
            t.fontSize = fontSize
            t.fillColor = fillColor
            return g.add(t)

        ascent=getFont(fontName).face.ascent/1000.
        if ascent==0: ascent=0.718 # default (from helvetica)
        ascent=ascent*fontSize # normalize

        columnCount = 0
        count = 0
        callout = getattr(self,'callout',None)
        for col, name in colorNamePairs:
            T = string.split(name and str(name) or '','\n')
            S = []
            # thisy+dy/2 = y+leading/2
            y = thisy+(dy-ascent)*0.5
            if callout: callout(self,g,thisx,y,colorNamePairs[count])
            if alignment == "left":
                for t in T:
                    # align text to left
                    s = String(thisx+maxWidth,y,t)
                    s.textAnchor = "end"
                    S.append(s)
                    y = y-leading
                x = thisx+maxWidth+dxTextSpace
            elif alignment == "right":
                for t in T:
                    # align text to right
                    s = String(thisx+dx+dxTextSpace, y, t)
                    s.textAnchor = "start"
                    S.append(s)
                    y = y-leading
                x = thisx
            else:
                raise ValueError, "bad alignment"

            # Make a 'normal' color swatch...
            if isinstance(col, colors.Color):
                r = Rect(x, thisy, dx, dy)
                r.fillColor = col
                r.strokeColor = strokeColor
                r.strokeWidth = strokeWidth
                g.add(r)
            else:
                #try and see if we should do better.
                try:
                    c = copy.deepcopy(col)
                    c.x = x
                    c.y = thisy
                    c.width = dx
                    c.height = dy
                    g.add(c)
                except:
                    pass

            map(gAdd,S)

            if count%columnMaximum == columnMaximum-1:
                thisx = thisx+deltax
                thisy = upperlefty
                columnCount = columnCount + 1
            else:
                thisy = thisy-max(deltay,len(S)*leading)
            count = count+1

        return g
开发者ID:eaudeweb,项目名称:naaya,代码行数:88,代码来源:legends.py

示例14: Rect

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
>>> from reportlab.lib.colors import red, green
>>> r = Rect(5, 5, 200, 100)
>>> r.fillColor = red
>>> r.strokeColor = green
>>> r.strokeWidth = 3
>>>
"""
)

from reportlab.graphics.shapes import Rect
from reportlab.lib.colors import red, green

d = Drawing(220, 120)
r = Rect(5, 5, 200, 100)
r.fillColor = red
r.strokeColor = green
r.strokeWidth = 3
d.add(r)
draw(d, "red rectangle with green border")

disc(
    """
<i>Note: In future examples we will omit the import statements.</i>
"""
)

disc(
    """
All shapes have a number of properties which can be set.
At an interactive prompt, we can use their <i>dumpProperties()</i>
method to list these.
开发者ID:jbacou,项目名称:myReportLab_installPackage,代码行数:33,代码来源:graph_shapes.py

示例15: Drawing

# 需要导入模块: from reportlab.graphics.shapes import Rect [as 别名]
# 或者: from reportlab.graphics.shapes.Rect import strokeColor [as 别名]
from reportlab.graphics.charts.piecharts import Pie
from reportlab.lib.colors import PCMYKColor, HexColor
from reportlab.graphics.shapes import Drawing, _DrawingEditorMixin, Rect

if __name__ == "__main__":


    c = canvas.Canvas("report.pdf", pagesize=letter)
    # move the origin up and to the left
    #c.translate(inch,inch)
    #c.setFillColorRGB(1,0,1)

    headerCanvas = Drawing()
    headerRect = Rect(0, 0, width=650, height=50)
    headerRect.fillColor = HexColor("#607D8B")
    headerRect.strokeColor = HexColor("#607D8B")
    headerCanvas.add(headerRect)
    renderPDF.draw(headerCanvas, c, 0, 750)


    c.drawImage("kit-logo.png", 50, 650, width=100, height=100)

    headerText = c.beginText(200, 750)
    headerText.textLine("Header Test Text")
    c.drawText(headerText)

    chartCanvas = Drawing()
    chartCanvas.hAlign = 'CENTER'
    chart = SimpleTimeSeriesPlot()
    chart.height = 150
    chart.width = 500
开发者ID:denisvolokh,项目名称:reportlab-report-prototype,代码行数:33,代码来源:main.py


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