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

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

示例1: test_11_drawing

​点赞 4

# 需要导入模块: 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('JY.zenist.song - ??', 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,

示例2: demo

​点赞 3

# 需要导入模块: 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,

示例3: demo

​点赞 3

# 需要导入模块: 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,

示例4: sample2c

​点赞 3

# 需要导入模块: 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,

示例5: sample3

​点赞 3

# 需要导入模块: 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,

示例6: sample3a

​点赞 3

# 需要导入模块: 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,

示例7: sample4a

​点赞 3

# 需要导入模块: 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,

示例8: sample4b

​点赞 3

# 需要导入模块: 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,

示例9: sample4c1

​点赞 3

# 需要导入模块: 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,

示例10: sample5b

​点赞 3

# 需要导入模块: 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,

示例11: sample6a

​点赞 3

# 需要导入模块: 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,

示例12: sample6b

​点赞 3

# 需要导入模块: 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,

示例13: sample6d

​点赞 3

# 需要导入模块: 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,

示例14: sample7a

​点赞 3

# 需要导入模块: 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,

示例15: sample7b

​点赞 3

# 需要导入模块: 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,

示例16: sample7c

​点赞 3

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample7c():

"Sample drawing, xvalue/ycat axes, y connected at value 30 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 = 'value'

yAxis.joinAxisPos = 30

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,代码行数:20,

示例17: sample7d

​点赞 3

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample7d():

"Sample drawing, xvalue/ycat axes, y connected at 200 pts to 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 = 'points'

yAxis.joinAxisPos = 200

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,代码行数:20,

示例18: sample0b

​点赞 3

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample0b():

"Make a degenerated pie chart with only one slice."

d = Drawing(400, 200)

pc = Pie()

pc.x = 150

pc.y = 50

pc.width = 120

pc.height = 100

pc.data = [10]

pc.labels = ['a']

pc.slices.strokeWidth=1#0.5

d.add(pc)

return d

开发者ID:aragos,项目名称:tichu-tournament,代码行数:19,

示例19: sample3

​点赞 3

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample3():

"Make a pie chart with a very slim slice."

d = Drawing(400, 200)

pc = Pie()

pc.x = 125

pc.y = 25

pc.data = [74, 1, 25]

pc.width = 150

pc.height = 150

pc.slices.strokeWidth=1#0.5

pc.slices[0].fillColor = colors.steelblue

pc.slices[1].fillColor = colors.thistle

pc.slices[2].fillColor = colors.cornflower

d.add(pc)

return d

开发者ID:aragos,项目名称:tichu-tournament,代码行数:23,

示例20: sample4

​点赞 3

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample4():

"Make a pie chart with several very slim slices."

d = Drawing(400, 200)

pc = Pie()

pc.x = 125

pc.y = 25

pc.data = [74, 1, 1, 1, 1, 22]

pc.width = 150

pc.height = 150

pc.slices.strokeWidth=1#0.5

pc.slices[0].fillColor = colors.steelblue

pc.slices[1].fillColor = colors.thistle

pc.slices[2].fillColor = colors.cornflower

pc.slices[3].fillColor = colors.lightsteelblue

pc.slices[4].fillColor = colors.aquamarine

pc.slices[5].fillColor = colors.cadetblue

d.add(pc)

return d

开发者ID:aragos,项目名称:tichu-tournament,代码行数:26,

示例21: demo

​点赞 3

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def demo(self):

"""Shows basic use of a line chart."""

drawing = Drawing(200, 100)

data = [

(13, 5, 20, 22, 37, 45, 19, 4),

(14, 10, 21, 28, 38, 46, 25, 5)

]

lc = HorizontalLineChart()

lc.x = 20

lc.y = 10

lc.height = 85

lc.width = 170

lc.data = data

lc.lines.symbol = makeMarker('Circle')

drawing.add(lc)

return drawing

开发者ID:aragos,项目名称:tichu-tournament,代码行数:24,

示例22: demo

​点赞 3

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [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:aragos,项目名称:tichu-tournament,代码行数:21,

示例23: add_lineChart

​点赞 3

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def add_lineChart(self, title, data, size=(PAGE_WIDTH-100, 300)):

'''

???????

:param title: ?????

:param data: ?????

'''

__chart_width, __chart_heigh = size[0], size[1]

__draw = Drawing(__chart_width, __chart_heigh)

__draw.add(String(20, __chart_heigh-10, title, fontName="chsFont",fontSize=18, fillColor=colors.black))

lc = HorizontalLineChart()

lc.x, lc.y = 25, 50

lc.width, lc.height = __chart_width-50, __chart_heigh-100

lc.data = data

lc.joinedLines = 1

lc.valueAxis.valueMin = min(data[0])

lc.valueAxis.valueMax = max(data[0])

valueRange = lc.valueAxis.valueMax - lc.valueAxis.valueMin

lc.valueAxis.valueStep = valueRange / 10.0

__draw.add(lc)

self.__content.append(__draw)

开发者ID:zenist,项目名称:ZLib,代码行数:25,

示例24: hello

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def hello(c, link):

c.translate(ORIGIN_X, ORIGIN_Y)

# Draw paragraph

stylesheet = getSampleStyleSheet()

style = stylesheet['BodyText']

style.fontName = 'LeagueGothic'

style.fontSize = 42

style.leading = 44

p = Paragraph('print
yourbadge
here', style)

qr_left = 30*mm

p_w, p_h = p.wrap(qr_left, HEIGHT)

p.drawOn(c, 0, 0)

# Add QR Code

qr_code = qr.QrCodeWidget(link)

qr_bounds = qr_code.getBounds()

qr_width = qr_bounds[2] - qr_bounds[0]

qr_height = qr_bounds[3] - qr_bounds[1]

d = Drawing(HEIGHT, HEIGHT, transform=[HEIGHT/qr_width,0,0,HEIGHT/qr_height,0,0])

d.add(qr_code)

renderPDF.draw(d, c, qr_left, 0)

# Draw thin line between text and QR code

c.line(qr_left, 0, qr_left, HEIGHT)

c.line(qr_left + HEIGHT, 0, qr_left+HEIGHT, HEIGHT)

img_left = qr_left + HEIGHT

# Draw images

c.drawImage('images/ipv6.jpg', img_left, 0, 20*mm, 1/3 * HEIGHT, mask=None, preserveAspectRatio=True, anchor='c')

c.drawImage('images/ffrhein_logo_claim_line_rot.png', img_left, 1/3*HEIGHT, 20*mm, 2/3 * HEIGHT, mask=None, preserveAspectRatio=True, anchor='c')

开发者ID:markuslindenberg,项目名称:badge-o-matic,代码行数:36,

示例25: imprimir

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def imprimir(self):

y=300

buffer = self.buffer

izquierda = ParagraphStyle('parrafos',

alignment = TA_LEFT,

fontSize = 10,

fontName="Times-Roman")

doc = SimpleDocTemplate(buffer,

rightMargin=50,

leftMargin=50,

topMargin=20,

bottomMargin=50,

pagesize=self.pagesize)

elements = []

styles = getSampleStyleSheet()

elements.append(self.tabla_encabezado(styles))

elements.append(Spacer(1, 0.25 * cm))

elements.append(self.tabla_datos(styles))

elements.append(Spacer(1, 0.25 * cm))

elements.append(self.tabla_detalle())

elements.append(Spacer(1,0.25 * cm))

elements.append(self.tabla_total_letras())

elements.append(Spacer(1, 0.25 * cm))

elements.append(self.tabla_otros())

elements.append(Spacer(1, 0.25 * cm))

elements.append(self.tabla_observaciones())

elements.append(Spacer(1, 0.25 * cm))

elements.append(self.tabla_afectacion_presupuestal())

linea_firma = Line(280, y-250, 470, y-250)

d = Drawing(100, 1)

d.add(linea_firma)

elements.append(d)

doc.build(elements)

pdf = buffer.getvalue()

buffer.close()

return pdf

开发者ID:joseamaya,项目名称:tambox,代码行数:39,

示例26: demo

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def demo(self):

D = Drawing(self.width, self.height)

D.add(self)

return D

开发者ID:aragos,项目名称:tichu-tournament,代码行数:6,

示例27: test

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def test():

"""This function produces a pdf with examples. """

#white on blue

rl = RL_CorpLogo()

rl.width = 129

rl.height = 86

D = Drawing(rl.width,rl.height)

D.add(rl)

D.__dict__['verbose'] = 1

D.save(fnRoot='corplogo_whiteonblue',formats=['pdf','eps','jpg','gif'])

#blue on white

rl = RL_CorpLogoReversed()

rl.width = 129

rl.height = 86

D = Drawing(rl.width,rl.height)

D.add(rl)

D.__dict__['verbose'] = 1

D.save(fnRoot='corplogo_blueonwhite',formats=['pdf','eps','jpg','gif'])

#gray on white

rl = RL_CorpLogoReversed()

rl.fillColor = Color(0.2, 0.2, 0.2)

rl.width = 129

rl.height = 86

D = Drawing(rl.width,rl.height)

D.add(rl)

D.__dict__['verbose'] = 1

D.save(fnRoot='corplogo_grayonwhite',formats=['pdf','eps','jpg','gif'])

rl = RL_BusinessCard()

rl.x=25

rl.y=25

rl.border=1

D = Drawing(rl.width+50,rl.height+50)

D.add(rl)

D.__dict__['verbose'] = 1

D.save(fnRoot='RL_BusinessCard',formats=['pdf'])

开发者ID:aragos,项目名称:tichu-tournament,代码行数:43,

示例28: demo

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def demo(self):

"""Shows basic use of a line chart."""

drawing = Drawing(400, 200)

data = [

((1,1), (2,2), (2.5,1), (3,3), (4,5)),

((1,2), (2,3), (2.5,2), (3.5,5), (4,6))

]

lp = LinePlot()

lp.x = 50

lp.y = 50

lp.height = 125

lp.width = 300

lp.data = data

lp.joinedLines = 1

lp.lineLabelFormat = '%2.0f'

lp.strokeColor = colors.black

lp.lines[0].strokeColor = colors.red

lp.lines[0].symbol = makeMarker('FilledCircle')

lp.lines[1].strokeColor = colors.blue

lp.lines[1].symbol = makeMarker('FilledDiamond')

lp.xValueAxis.valueMin = 0

lp.xValueAxis.valueMax = 5

lp.xValueAxis.valueStep = 1

lp.yValueAxis.valueMin = 0

lp.yValueAxis.valueMax = 7

lp.yValueAxis.valueStep = 1

drawing.add(lp)

return drawing

开发者ID:aragos,项目名称:tichu-tournament,代码行数:39,

示例29: sample1a

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample1a():

"A line plot with non-equidistant points in x-axis."

drawing = Drawing(400, 200)

data = [

((1,1), (2,2), (2.5,1), (3,3), (4,5)),

((1,2), (2,3), (2.5,2), (3.5,5), (4,6))

]

lp = LinePlot()

lp.x = 50

lp.y = 50

lp.height = 125

lp.width = 300

lp.data = data

lp.joinedLines = 1

lp.strokeColor = colors.black

lp.lines.symbol = makeMarker('UK_Flag')

lp.lines[0].strokeWidth = 2

lp.lines[1].strokeWidth = 4

lp.xValueAxis.valueMin = 0

lp.xValueAxis.valueMax = 5

lp.xValueAxis.valueStep = 1

lp.yValueAxis.valueMin = 0

lp.yValueAxis.valueMax = 7

lp.yValueAxis.valueStep = 1

drawing.add(lp)

return drawing

开发者ID:aragos,项目名称:tichu-tournament,代码行数:38,

示例30: sample1b

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample1b():

"A line plot with non-equidistant points in x-axis."

drawing = Drawing(400, 200)

data = [

((1,1), (2,2), (2.5,1), (3,3), (4,5)),

((1,2), (2,3), (2.5,2), (3.5,5), (4,6))

]

lp = LinePlot()

lp.x = 50

lp.y = 50

lp.height = 125

lp.width = 300

lp.data = data

lp.joinedLines = 1

lp.lines.symbol = makeMarker('Circle')

lp.lineLabelFormat = '%2.0f'

lp.strokeColor = colors.black

lp.xValueAxis.valueMin = 0

lp.xValueAxis.valueMax = 5

lp.xValueAxis.valueSteps = [1, 2, 2.5, 3, 4, 5]

lp.xValueAxis.labelTextFormat = '%2.1f'

lp.yValueAxis.valueMin = 0

lp.yValueAxis.valueMax = 7

lp.yValueAxis.valueStep = 1

drawing.add(lp)

return drawing

开发者ID:aragos,项目名称:tichu-tournament,代码行数:36,

示例31: sample1c

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample1c():

"A line plot with non-equidistant points in x-axis."

drawing = Drawing(400, 200)

data = [

((1,1), (2,2), (2.5,1), (3,3), (4,5)),

((1,2), (2,3), (2.5,2), (3.5,5), (4,6))

]

lp = LinePlot()

lp.x = 50

lp.y = 50

lp.height = 125

lp.width = 300

lp.data = data

lp.joinedLines = 1

lp.lines[0].symbol = makeMarker('FilledCircle')

lp.lines[1].symbol = makeMarker('Circle')

lp.lineLabelFormat = '%2.0f'

lp.strokeColor = colors.black

lp.xValueAxis.valueMin = 0

lp.xValueAxis.valueMax = 5

lp.xValueAxis.valueSteps = [1, 2, 2.5, 3, 4, 5]

lp.xValueAxis.labelTextFormat = '%2.1f'

lp.yValueAxis.valueMin = 0

lp.yValueAxis.valueMax = 7

lp.yValueAxis.valueSteps = [1, 2, 3, 5, 6]

drawing.add(lp)

return drawing

开发者ID:aragos,项目名称:tichu-tournament,代码行数:37,

示例32: demo

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def demo(self,drawing=None):

from reportlab.lib import colors

if not drawing:

tx,ty=self._getDrawingDimensions()

drawing = Drawing(tx,ty)

drawing.add(self.draw())

return drawing

开发者ID:aragos,项目名称:tichu-tournament,代码行数:9,

示例33: demo

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def demo(self):

self.setPosition(50, 10, 80)

self.configure([(10,20,30)])

self.categoryNames = ['One','Two','Three']

# all labels top-centre aligned apart from the last

self.labels.boxAnchor = 'e'

self.labels[2].boxAnchor = 's'

self.labels[2].angle = 90

d = Drawing(200, 100)

d.add(self)

return d

开发者ID:aragos,项目名称:tichu-tournament,代码行数:14,

示例34: sample0a

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample0a():

"Sample drawing with one xcat axis and two buckets."

drawing = Drawing(400, 200)

data = [(10, 20)]

xAxis = XCategoryAxis()

xAxis.setPosition(75, 75, 300)

xAxis.configure(data)

xAxis.categoryNames = ['Ying', 'Yang']

xAxis.labels.boxAnchor = 'n'

drawing.add(xAxis)

return drawing

开发者ID:aragos,项目名称:tichu-tournament,代码行数:16,

示例35: sample0b

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample0b():

"Sample drawing with one xcat axis and one bucket only."

drawing = Drawing(400, 200)

data = [(10,)]

xAxis = XCategoryAxis()

xAxis.setPosition(75, 75, 300)

xAxis.configure(data)

xAxis.categoryNames = ['Ying']

xAxis.labels.boxAnchor = 'n'

drawing.add(xAxis)

return drawing

开发者ID:aragos,项目名称:tichu-tournament,代码行数:16,

示例36: sample4c

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample4c():

"Sample drawing, xvalue/yvalue axes, y connected to bottom 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 = 'bottom'

xAxis.configure(data)

drawing.add(xAxis)

drawing.add(yAxis)

return drawing

开发者ID:aragos,项目名称:tichu-tournament,代码行数:17,

示例37: sample4d

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample4d():

"Sample drawing, xvalue/yvalue axes, y connected to top 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 = 'top'

xAxis.configure(data)

drawing.add(xAxis)

drawing.add(yAxis)

return drawing

开发者ID:aragos,项目名称:tichu-tournament,代码行数:17,

示例38: sample5c

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample5c():

"Sample drawing, xvalue/yvalue axes, y connected at right 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 = 'right'

yAxis.configure(data)

drawing.add(xAxis)

drawing.add(yAxis)

return drawing

开发者ID:aragos,项目名称:tichu-tournament,代码行数:17,

示例39: sample5d

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample5d():

"Sample drawing, xvalue/yvalue axes, y connected at left 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 = 'left'

yAxis.configure(data)

drawing.add(xAxis)

drawing.add(yAxis)

return drawing

开发者ID:aragos,项目名称:tichu-tournament,代码行数:17,

示例40: demo

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def demo(self):

d = Drawing(200, 100)

pc = Pie()

pc.x = 50

pc.y = 10

pc.width = 100

pc.height = 80

pc.data = [10,20,30,40,50,60]

pc.labels = ['a','b','c','d','e','f']

pc.slices.strokeWidth=0.5

pc.slices[3].popout = 10

pc.slices[3].strokeWidth = 2

pc.slices[3].strokeDashArray = [2,2]

pc.slices[3].labelRadius = 1.75

pc.slices[3].fontColor = colors.red

pc.slices[0].fillColor = colors.darkcyan

pc.slices[1].fillColor = colors.blueviolet

pc.slices[2].fillColor = colors.blue

pc.slices[3].fillColor = colors.cyan

pc.slices[4].fillColor = colors.aquamarine

pc.slices[5].fillColor = colors.cadetblue

pc.slices[6].fillColor = colors.lightcoral

d.add(pc)

return d

开发者ID:aragos,项目名称:tichu-tournament,代码行数:29,

示例41: sample0a

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample0a():

"Make a degenerated pie chart with only one slice."

d = Drawing(400, 200)

pc = Pie()

pc.x = 150

pc.y = 50

pc.data = [10]

pc.labels = ['a']

pc.slices.strokeWidth=1#0.5

d.add(pc)

return d

开发者ID:aragos,项目名称:tichu-tournament,代码行数:17,

示例42: sample2

​点赞 2

# 需要导入模块: from reportlab.graphics import shapes [as 别名]

# 或者: from reportlab.graphics.shapes import Drawing [as 别名]

def sample2():

"Make a pie chart with nine slices."

d = Drawing(400, 200)

pc = Pie()

pc.x = 125

pc.y = 25

pc.data = [0.31, 0.148, 0.108,

0.076, 0.033, 0.03,

0.019, 0.126, 0.15]

pc.labels = ['1', '2', '3', '4', '5', '6', '7', '8', 'X']

pc.width = 150

pc.height = 150

pc.slices.strokeWidth=1#0.5

pc.slices[0].fillColor = colors.steelblue

pc.slices[1].fillColor = colors.thistle

pc.slices[2].fillColor = colors.cornflower

pc.slices[3].fillColor = colors.lightsteelblue

pc.slices[4].fillColor = colors.aquamarine

pc.slices[5].fillColor = colors.cadetblue

pc.slices[6].fillColor = colors.lightcoral

pc.slices[7].fillColor = colors.tan

pc.slices[8].fillColor = colors.darkseagreen

d.add(pc)

return d

开发者ID:aragos,项目名称:tichu-tournament,代码行数:32,

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

python画正方形的代码drawingpanel_Python shapes.Drawing方法代码示例相关推荐

  1. python画正方形的代码_python画正方形的代码是什么?

    python画正方形的代码是什么? python画正方形的代码是:import turtle #导入 turtle.title("画正方形") turtle.pensize(5) ...

  2. python画正方形并涂色_这种图片怎么用python画出来,每一个数字代表一种颜色?...

    Python 画正方形,写数字的代码如下: from PIL import Image, ImageDraw, ImageFont, ImageFilter WIDTH = 100 * 4 HEIGH ...

  3. python横向柱状图-python画柱状图--不同颜色并显示数值的方法

    用python画柱状图容易,但是如何对不同柱子使用不同颜色呢?同时在柱子顶端显示精确数值? 主要用的方法为: atplotlib.pyplot.bar(left, height, width=0.8, ...

  4. python杨辉三角代码,python实现杨辉三角的几种方法代码实例

    方法一:迭代 def triangle_1(x): """ :param x: 需要生成的杨辉三角行数 :return: """ trian ...

  5. Python pandas 保存Excel自动调整列宽的方法及示例代码

    本文主要介绍Python中,使用pandas.ExcelWriter保存Excel文件数据时,自动判断调整列的宽度方法,以及相关的示例代码. 原文地址:Python pandas 保存Excel自动调 ...

  6. python画正方形的代码_python绘制正方形螺旋线的代码分享

    python绘制正方形螺旋线的代码分享 发布时间:2020-04-28 09:56:56 来源:亿速云 阅读:219 作者:小新 这篇文章主要为大家详细介绍了python绘制正方形螺旋线的代码分享,文 ...

  7. python画正方形-用python画正方形

    广告关闭 腾讯云11.11云上盛惠 ,精选热门产品助力上云,云服务器首年88元起,买的越多返的越多,最高返5000元! 我正在学习python学习教程,我无法打开屏幕进行绘图. 我没有发现错误,它只是 ...

  8. python画正方形程序_画正方形-小学生 Python 入门课

    画正方形 还没开始学就要画正方形啊!会不会太难啊? 今天主要是教大家简化版的程序设计流程,其实和大家在日常生活中做的事情是一样的. 第一步:准备画画的工具包(纸和铅笔) 用Python代码就是导入工具 ...

  9. python画正方形-如何用python画正方形

    广告关闭 腾讯云11.11云上盛惠 ,精选热门产品助力上云,云服务器首年88元起,买的越多返的越多,最高返5000元! 我正在学习python学习教程,我无法打开屏幕进行绘图. 我没有发现错误,它只是 ...

最新文章

  1. vue 修改div宽度_vue 拖动调整左右两侧div的宽度
  2. jquery validation remote进行唯一性验证时只使用自定义参数,不使用默认参数
  3. 关于Hibernate
  4. Android官方开发文档Training系列课程中文版:OpenGL绘图之环境配置
  5. 如何合理的配置线程数?
  6. C++ 查看输入流中的下一个字符
  7. shardingsphere 分片策略_ShardingSphere系列(二) 分片策略
  8. java添加主类包_java – Maven bundle插件 – 如何添加主类
  9. 为opencv添加contrib库
  10. 【产品】 产品设计:工业设计(ID设计)系列软件介绍:平面设计、建模和3D渲染
  11. 第六篇:A133 用DragonSN工具刷SN号,MAC地址细节问题
  12. 【校内互侧】ZYF loves binary (dp)
  13. android 浏览器 该网站的安全证书有问题
  14. 赛式方法论(上):为什么你的游戏做不完、做得烂?
  15. linux窗口死,Linux系统入门学习:Linux 上 Wireshark 界面僵死解决
  16. 汉字进行计算机识别的原理,计算机OCR文字识别技术的原理和未来发展趋势
  17. 百度地图导航的接入(包含三种选择方式驾车、公交、步行)
  18. IEEE T PAMI投稿注意事项
  19. 【Arduino】重生之Arduino 学僧(1)----Arduino简介
  20. 索骥馆-思维训练之最佳记忆方法-王洪礼的奇象记忆思维技术与方法 》扫描版[PDF]

热门文章

  1. 2021年5月:百度最近的文章收录变慢了?连老站都不好使了?
  2. 国内外比较出名的聚合路由器都有哪些?
  3. 【牛投客】:牛投客经过三年的投资
  4. DOS汇编程序提高练习
  5. 什么是电商e-commerce
  6. 计算机中丢失ENWeb,vbaen32.olb
  7. Spring Cloud Alibaba-SkyWalking链路追踪
  8. excel制作田字格,excel行高磅,列宽1/10英寸;
  9. 【自学Docker 】Docker export命令
  10. 从签到功能到用户激励体系——产品经理项目实录