本文整理汇总了Python中reportlab.pdfgen.canvas.line函数的典型用法代码示例。如果您正苦于以下问题:Python line函数的具体用法?Python line怎么用?Python line使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了line函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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)
开发者ID:ChipM,项目名称:cakeshow2,代码行数:35,代码来源:form_generator.py
示例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()
开发者ID:hanleybrand,项目名称:rooibos,代码行数:28,代码来源:viewers.py
示例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))
开发者ID:adioslabs,项目名称:barcodatron,代码行数:7,代码来源:kitlabels.py
示例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
开发者ID:Nehri,项目名称:making-records,代码行数:33,代码来源:laser_cut_generator.py
示例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)
开发者ID:roytest001,项目名称:PythonCode,代码行数:7,代码来源:customshapes.py
示例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()
开发者ID:nickdepinet,项目名称:resume,代码行数:28,代码来源:resume.py
示例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)
开发者ID:ctb,项目名称:paircomp,代码行数:8,代码来源:plot-pdf.py
示例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()
开发者ID:jameshickey,项目名称:ReportLab,代码行数:8,代码来源:test_pdfgen_general.py
示例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)
开发者ID:binbinc,项目名称:py2sd,代码行数:8,代码来源:SdBackGround.py
示例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))
开发者ID:AdamLuchjenbroers,项目名称:SolarisStables,代码行数:8,代码来源:pdf.py
示例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)
开发者ID:drmelectronic,项目名称:palabrayespiritu,代码行数:9,代码来源:pdf.py
示例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
开发者ID:nibrahim,项目名称:Calligraphic-Rulings,代码行数:9,代码来源:ruling.py
示例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
开发者ID:jovanbrakus,项目名称:resumegen,代码行数:9,代码来源:generator.py
示例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()
开发者ID:commtrack,项目名称:commcare-hq,代码行数:10,代码来源:doctemplate.py
示例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)
开发者ID:ses4j,项目名称:ts,代码行数:11,代码来源:invoice.py
示例16: drawOn
def drawOn(self, canvas, label=None):
canvas.line(self.p1[0], self.p1[1], self.p2[0], self.p2[1])
canvas.circle(*self.p1, r=1*mm, fill=True)
canvas.circle(*self.p2, r=1*mm, fill=False)
if label is not None:
textobject = canvas.beginText()
center = ((self.p1 + self.p2)/2.)
textobject.setTextOrigin(*center)
textobject.setFont("Helvetica", 8)
textobject.textOut(label)
canvas.drawText(textobject)
开发者ID:ashwin15990,项目名称:clockthree,代码行数:11,代码来源:stand.py
示例17: drawlines
def drawlines(canvas):
canvas.setStrokeColorRGB(0.2,0.5,0.3)
canvas.line(0,0,70,70)
textobject = canvas.beginText()
textobject.setTextOrigin(51.2,749)
textobject.textLines('''
LEFT
FIELD
LABS
''')
canvas.drawText(textobject)
开发者ID:codedcolors,项目名称:lflpdf,代码行数:11,代码来源:maketimeline.py
示例18: myFirstPage
def myFirstPage(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-Bold',24)
canvas.drawString(108, PAGE_HEIGHT-108, "TABLE OF CONTENTS DEMO")
canvas.setFont('Times-Roman',12)
canvas.drawString(4 * inch, 0.75 * inch, "First Page")
canvas.restoreState()
开发者ID:commtrack,项目名称:commcare-hq,代码行数:12,代码来源:doctemplate.py
示例19: draw
def draw(self):
canvas = self.canv
couleurDate = None
positionSeparation = 20
# Couleur de la case Date de la journée
if AFFICHER_VACANCES == True and self.dateDD in LISTE_VACANCES : couleurDate = COULEUR_VACANCES
if AFFICHER_WE == True and (self.dateDD.weekday() == 5 or self.dateDD.weekday() == 6) : couleurDate = COULEUR_WE
if AFFICHER_FERIES == True and self.dateDD in LISTE_FERIES : couleurDate = COULEUR_FERIES
if couleurDate != None :
r, g, b = ConvertCouleur(couleurDate)
canvas.setFillColorRGB(r, g, b)
canvas.rect(0, 0, positionSeparation, self.hauteurCase, fill=1, stroke=False)
# Texte date
canvas.setFillColorRGB(0, 0, 0)
canvas.setFont("Helvetica", 7)
canvas.drawRightString(positionSeparation-2, 2, self.labelDate)
# Trait séparation Date et Heures
canvas.setLineWidth(0.25)
canvas.line(positionSeparation, 0, positionSeparation, self.hauteurCase)
# Si aucune présence ce jour -là
if len(self.dictBarres) == 0 : return
# Récup du nbre total d'heure de la journée
totalJour = self.dictBarres["totalJour"]
# Transformation du nombre d'heures par catégorie en pourcentage
listeCategories = []
for IDcategorie, nbreHeures in self.dictBarres.items():
if IDcategorie != "totalJour" :
largeurBarre = nbreHeures * 1.0 * (self.largeurCase-positionSeparation-0.25) / totalJour
listeCategories.append( (largeurBarre, IDcategorie) )
listeCategories.sort()
# Création des graphes
if AFFICHER_COULEUR_CATEGORIES == True :
positionTemp = positionSeparation+0.25
for largeurBarre, IDcategorie in listeCategories :
r, g, b = ConvertCouleur(FormateCouleur(DICT_CATEGORIES[IDcategorie][2]))
canvas.setFillColorRGB(r, g, b)
canvas.rect(positionTemp, 0, largeurBarre, self.hauteurCase, fill=1, stroke=False)
positionTemp += largeurBarre
# Label Total Heure de la journée
if AFFICHER_HEURES == True :
canvas.setFillColorRGB(0, 0, 0)
canvas.setFont("Helvetica", 7)
canvas.drawRightString(self.largeurCase-2, 2, "%s" % minutesEnHeures(totalJour))
开发者ID:Noethys,项目名称:Teamworks,代码行数:52,代码来源:DLG_Impression_calendrier_annuel.py
示例20: framePage
def framePage(canvas, doc):
# canvas.drawImage("snkanim.gif", 36, 36)
canvas.saveState()
canvas.setStrokeColorRGB(1, 0, 0)
canvas.setLineWidth(5)
canvas.line(66, 72, 66, PAGE_HEIGHT - 72)
canvas.setFont("Times-Italic", 12)
canvas.drawRightString(523, PAGE_HEIGHT - 56, "Platypus User Guide and Test Script")
canvas.setFont("Times-Roman", 12)
canvas.drawString(4 * inch, 0.75 * inch, "Page %d" % canvas.getPageNumber())
canvas.restoreState()
开发者ID:jameshickey,项目名称:ReportLab,代码行数:13,代码来源:test_platypus_general.py
注:本文中的reportlab.pdfgen.canvas.line函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论