本文整理汇总了Python中reportlab.pdfgen.canvas.line函数的典型用法代码示例。如果您正苦于以下问题:Python line函数的具体用法?Python line怎么用?Python line使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了line函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: judging_divisional_body
def judging_divisional_body(canvas):
criteria = ["Precision", "Originality", "Creativity", "Skill", "Color", "Design", "Difficulty", "Number of Techniques", "Overall Eye Appeal"]
# Table header
canvas.drawString(3.30 * inch, 8.375 * inch, " Needs")
canvas.drawString(3.30 * inch, 8.125 * inch, "Improvement")
canvas.drawString(4.85 * inch, 8.25 * inch, "Fair")
canvas.drawString(5.750 * inch, 8.25 * inch, "Good")
canvas.drawString(6.750 * inch, 8.25 * inch, "Excellent")
# Display column of criteria
offset = 7.75
for criterium in criteria:
canvas.drawString(1.125 * inch, offset * inch, criterium)
offset -= 0.375
# Build up rows
rows = []
offset = 8.00
for criterium in criteria:
rows.append(offset * inch)
offset -= 0.375
rows.append(offset * inch)
# Draw grid
canvas.grid([inch, 3.25 * inch, 4.50 * inch, 5.50 * inch, 6.50 * inch, 7.75 * inch], rows)
# Display comments section
offset -= 0.5
canvas.drawString(inch, offset * inch, "Comments: ")
canvas.line(2.25 * inch, offset * inch, 7.5 * inch, offset * inch)
while (offset > 1.5):
offset -= 0.5
canvas.line(1 * inch, offset * inch, 7.5 * inch, offset * inch)
示例2: prepare_first_page
def prepare_first_page(canvas, document):
p1 = Paragraph(presentation.title, styles['Heading'])
p2 = Paragraph(
presentation.owner.get_full_name(), styles['SubHeading'])
avail_width = width - inch
avail_height = height - inch
w1, h1 = p1.wrap(avail_width, avail_height)
w2, h2 = p2.wrap(avail_width, avail_height)
f = Frame(
inch / 2,
inch / 2,
width - inch,
height - inch,
leftPadding=0,
bottomPadding=0,
rightPadding=0,
topPadding=0
)
f.addFromList([p1, p2], canvas)
document.pageTemplate.frames[0].height -= h1 + h2 + inch / 2
document.pageTemplate.frames[1].height -= h1 + h2 + inch / 2
canvas.saveState()
canvas.setStrokeColorRGB(0, 0, 0)
canvas.line(
width / 2, inch / 2, width / 2, height - inch - h1 - h2)
canvas.restoreState()
示例3: cutmark
def cutmark(canvas,x,y,xpol,ypol):
v('------')
cutlen = 10
canvas.line(x, y, x+cutlen*xpol, y)
v('cutmark() x,y,xe,ye %f %f %f %f' % (x, y, x+cutlen*xpol, y))
canvas.line(x, y, x , y+cutlen*ypol)
v('cutmark() x,y,xe,ye %f %f %f %f' % (x, y, x , y+cutlen*ypol))
示例4: drawOneCircle
def drawOneCircle(canvas, circle_data):
theta = float(0)
(x_last, y_last) = circle_data.points
radius = circle_data.radius
index = circle_data.index
last_cycle = circle_data.end
rad_calculation = radius
while theta < math.pi*2:
if not last_cycle:
rad_calculation = radius
if index != -1.0:
index += index_increments
x_val = 6*scale_num+rad_calculation*math.cos(theta)
y_val = 6*scale_num-rad_calculation*math.sin(theta)
if ((x_last - x_val)**2 +(y_last-y_val)**2)>min_distance**2:
if (x_last != 0.0 and y_last != 0.0) and (x_val != 0.0 and y_val != 0.0):
canvas.line(x_last, y_last, x_val, y_val)
x_last = x_val
y_last = y_val
if not last_cycle:
radius -= rad_increments
theta += theta_increments
if index == -1.0:
index = 0.0
circle_data.points = (x_last, y_last)
circle_data.radius = radius
circle_data.index = index
return circle_data
示例5: drawBounds
def drawBounds(self, canvas):
"""Guidelines to help me draw - not needed in production"""
canvas.setStrokeColor(colors.red)
canvas.rect(-100,-70,200,140)
canvas.line(-100,0,100,0)
canvas.line(0,70,0,-70)
canvas.setStrokeColor(colors.black)
示例6: myPage
def myPage(canvas, doc):
canvas.saveState() # save the current state
canvas.setFont('InconsolataBold', 16) # set the font for the name
canvas.drawString(
.4 * inch,
HEIGHT - (.4 * inch),
contact['name']) # draw the name on top left page 1
canvas.setFont('Inconsolata', 8) # sets the font for contact
canvas.drawRightString(
WIDTH - (.4 * inch),
HEIGHT - (.4 * inch),
contact['website'])
canvas.line(.4 * inch, HEIGHT - (.47 * inch),
WIDTH - (.4 * inch), HEIGHT - (.47 * inch))
canvas.drawString(
.4 * inch,
HEIGHT - (.6 * inch),
contact['phone'])
canvas.drawCentredString(
WIDTH / 2.0,
HEIGHT - (.6 * inch),
contact['address'])
canvas.drawRightString(
WIDTH - (.4 * inch),
HEIGHT - (.6 * inch),
contact['email'])
# restore the state to what it was when saved
canvas.restoreState()
示例7: f
def f(canvas, x, y, m):
x_1 = x * x_scale + x_start
x_2 = x_1 + x_scale
y_1 = y * y_scale + y_start
y_2 = y_1 + y_scale
canvas.line(x_1, y_1, x_2, y_2)
示例8: drawCrossHairs
def drawCrossHairs(canvas, x, y):
"""just a marker for checking text metrics - blue for fun"""
canvas.saveState()
canvas.setStrokeColorRGB(0, 1, 0)
canvas.line(x - 6, y, x + 6, y)
canvas.line(x, y - 6, x, y + 6)
canvas.restoreState()
示例9: _drawLifeline
def _drawLifeline(self, canvas):
for i in range(len(self.objectList)):
topX = getLifelineX(len(self.objectList), i)
topY = 50
bottomX = topX
bottomY = 750
canvas.line(topX, topY, bottomX, bottomY)
示例10: beforeDrawPage
def beforeDrawPage(self, canvas, doc):
if self.background != None:
self.background.draw_on(canvas)
(width, height) = canvas._pagesize
canvas.setLineWidth(0.2 * cm)
canvas.line(cm, height - (2*cm), width - cm, height - (2*cm))
canvas.line(cm, (2*cm), width - cm, (2*cm))
示例11: cabecera
def cabecera(self, canvas):
origen = Frame(self.MARGEN, A4[1] - 1.5 * cm,
A4[0] - (2 * self.MARGEN), 1 * cm,
id='cabecera', showBoundary=self.mostrar)
story = []
story.append(Paragraph(self.header, self.estilos['cabecera']))
origen.addFromList(story, canvas)
canvas.line(x1=self.MARGEN, y1=A4[1] - 1.2 * cm,
x2=A4[0] - (self.MARGEN), y2=A4[1] - 1.2 * cm)
示例12: draw_line_set
def draw_line_set(canvas, position, nib_width, partitions, pagesize):
"""Draws rulings for a single line of calligraphic text. Returns
position of last line drawn"""
offset = position
canvas.line(1*mm, offset, pagesize[0], offset)
for i in (float(x) for x in partitions.split(",")):
offset += i * nib_width * mm
canvas.line(1*mm, offset, pagesize[0], offset)
return offset
示例13: _draw_section_title
def _draw_section_title(canvas, yc, title):
title = title.upper()
title_x = H_TEXT_MARGIN
title_y = yc - SECTION_V_SPACE - SECTION_FONT_SIZE
line_y = title_y - V_SEPARATOR
canvas.setFont(SECTION_FONT, SECTION_FONT_SIZE)
canvas.drawString(title_x, title_y, title)
canvas.line(H_TEXT_MARGIN - H_LINE_MARGIN_OFFSET, line_y, RESUME_PAGE_SIZE[0] - (H_TEXT_MARGIN - H_LINE_MARGIN_OFFSET), line_y)
return line_y# - V_SEPARATOR
示例14: myLaterPages
def myLaterPages(canvas, doc):
from reportlab.lib.colors import red
PAGE_HEIGHT = canvas._pagesize[1]
canvas.saveState()
canvas.setStrokeColor(red)
canvas.setLineWidth(5)
canvas.line(66,72,66,PAGE_HEIGHT-72)
canvas.setFont('Times-Roman',12)
canvas.drawString(4 * inch, 0.75 * inch, "Page %d" % doc.page)
canvas.restoreState()
示例15: draw_header
def draw_header(canvas):
""" Draws the invoice header """
canvas.setStrokeColorRGB(176/255., 196/255., 222/255.)
# canvas.setStrokeColorRGB(0.9, 0.5, 0.2)
canvas.setFillColorRGB(0.2, 0.2, 0.2)
canvas.setFont('Helvetica', 16)
canvas.drawString(18 * cm, -1 * cm, 'Invoice')
if consultant_logo_filename:
canvas.drawInlineImage(consultant_logo_filename, 1 * cm, -1 * cm, 250, 16)
canvas.setLineWidth(4)
canvas.line(0, -1.25 * cm, 21.7 * cm, -1.25 * cm)