當前位置: 首頁>>代碼示例>>Python>>正文


Python shapes.Drawing方法代碼示例

本文整理匯總了Python中reportlab.graphics.shapes.Drawing方法的典型用法代碼示例。如果您正苦於以下問題:Python shapes.Drawing方法的具體用法?Python shapes.Drawing怎麽用?Python shapes.Drawing使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在reportlab.graphics.shapes的用法示例。


在下文中一共展示了shapes.Drawing方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_11_drawing

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [as 別名]
def test_11_drawing(self):
        from reportlab.lib.styles import getSampleStyleSheet
        from reportlab.lib import colors
        from reportlab.platypus import SimpleDocTemplate, Spacer, Paragraph
        from reportlab.pdfbase import pdfmetrics
        from reportlab.graphics.shapes import Drawing, Rect
        from reportlab.pdfbase.ttfonts import TTFont

        pdfmetrics.registerFont(TTFont('chsFont', 'STHeiti Light.ttc'))
        stylesheet = getSampleStyleSheet()

        elements = []
        doc = SimpleDocTemplate("demo.pdf")

        elements.append(Paragraph('<font name="chsFont">JY.zenist.song - ??</font>', stylesheet['Title']))
        elements.append(Spacer(1,12))

        d = Drawing(400,200)
        d.add(Rect(50,50,300,100, fillColor=colors.yellow))
        elements.append(d)

        doc.build(elements) 
開發者ID:zenist,項目名稱:ZLib,代碼行數:24,代碼來源:test_pdf.py

示例2: demo

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [as 別名]
def demo(self):
        """This shows a label positioned with its top right corner
        at the top centre of the drawing, and rotated 45 degrees."""

        d = Drawing(200, 100)

        # mark the origin of the label
        d.add(Circle(100,90, 5, fillColor=colors.green))

        lab = Label()
        lab.setOrigin(100,90)
        lab.boxAnchor = 'ne'
        lab.angle = 45
        lab.dx = 0
        lab.dy = -20
        lab.boxStrokeColor = colors.green
        lab.setText('Another\nMulti-Line\nString')
        d.add(lab)

        return d 
開發者ID:aragos,項目名稱:tichu-tournament,代碼行數:22,代碼來源:textlabels.py

示例3: demo

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [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:aragos,項目名稱:tichu-tournament,代碼行數:19,代碼來源:legends.py

示例4: sample2c

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [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:aragos,項目名稱:tichu-tournament,代碼行數:21,代碼來源:legends.py

示例5: sample3

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [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:aragos,項目名稱:tichu-tournament,代碼行數:20,代碼來源:legends.py

示例6: sample3a

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [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:aragos,項目名稱:tichu-tournament,代碼行數:26,代碼來源:legends.py

示例7: sample4a

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [as 別名]
def sample4a():
    "Sample drawing, xvalue/yvalue axes, y connected at 100 pts to x."
    drawing = Drawing(400, 200)
    data = [(10, 20, 30, 42)]
    yAxis = YValueAxis()
    yAxis.setPosition(50, 50, 125)
    yAxis.configure(data)
    xAxis = XValueAxis()
    xAxis._length = 300
    xAxis.joinAxis = yAxis
    xAxis.joinAxisMode = 'points'
    xAxis.joinAxisPos = 100
    xAxis.configure(data)
    drawing.add(xAxis)
    drawing.add(yAxis)
    return drawing 
開發者ID:aragos,項目名稱:tichu-tournament,代碼行數:18,代碼來源:axes.py

示例8: sample4b

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [as 別名]
def sample4b():
    "Sample drawing, xvalue/yvalue axes, y connected at value 35 of x."
    drawing = Drawing(400, 200)
    data = [(10, 20, 30, 42)]
    yAxis = YValueAxis()
    yAxis.setPosition(50, 50, 125)
    yAxis.configure(data)
    xAxis = XValueAxis()
    xAxis._length = 300
    xAxis.joinAxis = yAxis
    xAxis.joinAxisMode = 'value'
    xAxis.joinAxisPos = 35
    xAxis.configure(data)
    drawing.add(xAxis)
    drawing.add(yAxis)
    return drawing 
開發者ID:aragos,項目名稱:tichu-tournament,代碼行數:18,代碼來源:axes.py

示例9: sample4c1

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [as 別名]
def sample4c1():
    "xvalue/yvalue axes, without drawing axis lines/ticks."
    drawing = Drawing(400, 200)
    data = [(10, 20, 30, 42)]
    yAxis = YValueAxis()
    yAxis.setPosition(50, 50, 125)
    yAxis.configure(data)
    yAxis.visibleAxis = 0
    yAxis.visibleTicks = 0
    xAxis = XValueAxis()
    xAxis._length = 300
    xAxis.joinAxis = yAxis
    xAxis.joinAxisMode = 'bottom'
    xAxis.configure(data)
    xAxis.visibleAxis = 0
    xAxis.visibleTicks = 0
    drawing.add(xAxis)
    drawing.add(yAxis)
    return drawing 
開發者ID:aragos,項目名稱:tichu-tournament,代碼行數:21,代碼來源:axes.py

示例10: sample5b

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [as 別名]
def sample5b():
    "Sample drawing, xvalue/yvalue axes, y connected at value 35 of x."
    drawing = Drawing(400, 200)
    data = [(10, 20, 30, 42)]
    xAxis = XValueAxis()
    xAxis.setPosition(50, 50, 300)
    xAxis.configure(data)
    yAxis = YValueAxis()
    yAxis.setPosition(50, 50, 125)
    yAxis.joinAxis = xAxis
    yAxis.joinAxisMode = 'value'
    yAxis.joinAxisPos = 35
    yAxis.configure(data)
    drawing.add(xAxis)
    drawing.add(yAxis)
    return drawing 
開發者ID:aragos,項目名稱:tichu-tournament,代碼行數:18,代碼來源:axes.py

示例11: sample6a

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [as 別名]
def sample6a():
    "Sample drawing, xcat/yvalue axes, x connected at top of y."
    drawing = Drawing(400, 200)
    data = [(10, 20, 30, 42)]
    yAxis = YValueAxis()
    yAxis.setPosition(50, 50, 125)
    yAxis.configure(data)
    xAxis = XCategoryAxis()
    xAxis._length = 300
    xAxis.configure(data)
    xAxis.joinAxis = yAxis
    xAxis.joinAxisMode = 'top'
    xAxis.categoryNames = ['Beer', 'Wine', 'Meat', 'Cannelloni']
    xAxis.labels.boxAnchor = 'n'
    drawing.add(xAxis)
    drawing.add(yAxis)
    return drawing 
開發者ID:aragos,項目名稱:tichu-tournament,代碼行數:19,代碼來源:axes.py

示例12: sample6b

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [as 別名]
def sample6b():
    "Sample drawing, xcat/yvalue axes, x connected at bottom of y."
    drawing = Drawing(400, 200)
    data = [(10, 20, 30, 42)]
    yAxis = YValueAxis()
    yAxis.setPosition(50, 50, 125)
    yAxis.configure(data)
    xAxis = XCategoryAxis()
    xAxis._length = 300
    xAxis.configure(data)
    xAxis.joinAxis = yAxis
    xAxis.joinAxisMode = 'bottom'
    xAxis.categoryNames = ['Beer', 'Wine', 'Meat', 'Cannelloni']
    xAxis.labels.boxAnchor = 'n'
    drawing.add(xAxis)
    drawing.add(yAxis)
    return drawing 
開發者ID:aragos,項目名稱:tichu-tournament,代碼行數:19,代碼來源:axes.py

示例13: sample6d

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [as 別名]
def sample6d():
    "Sample drawing, xcat/yvalue axes, x connected at value 20 of y."
    drawing = Drawing(400, 200)
    data = [(10, 20, 30, 42)]
    yAxis = YValueAxis()
    yAxis.setPosition(50, 50, 125)
    yAxis.configure(data)
    xAxis = XCategoryAxis()
    xAxis._length = 300
    xAxis.configure(data)
    xAxis.joinAxis = yAxis
    xAxis.joinAxisMode = 'value'
    xAxis.joinAxisPos = 20
    xAxis.categoryNames = ['Beer', 'Wine', 'Meat', 'Cannelloni']
    xAxis.labels.boxAnchor = 'n'
    drawing.add(xAxis)
    drawing.add(yAxis)
    return drawing 
開發者ID:aragos,項目名稱:tichu-tournament,代碼行數:20,代碼來源:axes.py

示例14: sample7a

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [as 別名]
def sample7a():
    "Sample drawing, xvalue/ycat axes, y connected at right of x."
    drawing = Drawing(400, 200)
    data = [(10, 20, 30, 42)]
    xAxis = XValueAxis()
    xAxis._length = 300
    xAxis.configure(data)
    yAxis = YCategoryAxis()
    yAxis.setPosition(50, 50, 125)
    yAxis.joinAxis = xAxis
    yAxis.joinAxisMode = 'right'
    yAxis.categoryNames = ['Beer', 'Wine', 'Meat', 'Cannelloni']
    yAxis.labels.boxAnchor = 'e'
    yAxis.configure(data)
    drawing.add(xAxis)
    drawing.add(yAxis)
    return drawing 
開發者ID:aragos,項目名稱:tichu-tournament,代碼行數:19,代碼來源:axes.py

示例15: sample7b

# 需要導入模塊: from reportlab.graphics import shapes [as 別名]
# 或者: from reportlab.graphics.shapes import Drawing [as 別名]
def sample7b():
    "Sample drawing, xvalue/ycat axes, y connected at left of x."
    drawing = Drawing(400, 200)
    data = [(10, 20, 30, 42)]
    xAxis = XValueAxis()
    xAxis._length = 300
    xAxis.configure(data)
    yAxis = YCategoryAxis()
    yAxis.setPosition(50, 50, 125)
    yAxis.joinAxis = xAxis
    yAxis.joinAxisMode = 'left'
    yAxis.categoryNames = ['Beer', 'Wine', 'Meat', 'Cannelloni']
    yAxis.labels.boxAnchor = 'e'
    yAxis.configure(data)
    drawing.add(xAxis)
    drawing.add(yAxis)
    return drawing 
開發者ID:aragos,項目名稱:tichu-tournament,代碼行數:19,代碼來源:axes.py


注:本文中的reportlab.graphics.shapes.Drawing方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。