本文整理汇总了Python中reportlab.lib.colors.lightgrey方法的典型用法代码示例。如果您正苦于以下问题:Python colors.lightgrey方法的具体用法?Python colors.lightgrey怎么用?Python colors.lightgrey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.lib.colors
的用法示例。
在下文中一共展示了colors.lightgrey方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import lightgrey [as 别名]
def __init__(self,
width="80%",
thickness=1,
lineCap='round',
color=lightgrey,
spaceBefore=1, spaceAfter=1,
hAlign='CENTER', vAlign='BOTTOM',
dash=None):
Flowable.__init__(self)
self.width = width
self.lineWidth = thickness
self.lineCap=lineCap
self.spaceBefore = spaceBefore
self.spaceAfter = spaceAfter
self.color = color
self.hAlign = hAlign
self.vAlign = vAlign
self.dash = dash
示例2: add_code_example
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import lightgrey [as 别名]
def add_code_example(canvas, filename, plot_filename, x, y, width, height):
canvas.setFillColor(lightgrey)
canvas.rect(x, y, width, height, fill=1)
canvas.drawImage(
filename,
x,
20 * inch,
width=width,
height=height*0.2,
mask=[10, 255, 10, 255, 10, 255]
)
canvas.drawImage(
plot_filename,
x + width * 0.025,
y * 1.5,
width=width * 0.95,
height=height*0.5
)
#################################
# Create document and its pieces
#################################
# Canvas (PDF)
示例3: __init__
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import lightgrey [as 别名]
def __init__(self, data, horizontal_align=None, style=None):
Table.__init__(self, data, hAlign=horizontal_align)
default_style = [
('INNERGRID', (0, 0), (-1, -1), .25, colors.black),
('BOX', (0, 0), (-1, -1), .25, colors.black),
('BACKGROUND', (0, 0), (-1, -len(data)), colors.lightgrey),
('ALIGN', (0, 0), (-1, -1), 'CENTER'),
('VALIGN', (0, 0), (-1, -1), 'MIDDLE')
]
if style and isinstance(style, list):
default_style.extend(style)
self.setStyle(TableStyle(default_style))
示例4: add_fold_lines
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import lightgrey [as 别名]
def add_fold_lines(c):
"""Add lines to show where to fold card"""
# choose some colors
c.setFillColor(lightgrey)
# line settings
c.setLineWidth(1)
c.setDash(1,5) #n points on, m off
# draw some lines
c.line(width/2,0,width/2,height) #vertical
c.line(0,height/2,width,height/2) #horz.
示例5: _posting_list_table
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import lightgrey [as 别名]
def _posting_list_table(self, canvas, x1, y1, x2, y2, shipping_labels):
style = self.table_style[:]
table = [self.table_header]
for i, shipping_label in enumerate(shipping_labels, start=1):
row = (
str(shipping_label.tracking_code),
str(shipping_label.receiver.zip_code),
str(shipping_label.package.weight),
self.yes if ExtraService.get(EXTRA_SERVICE_AR) in shipping_label else self.no,
self.yes if ExtraService.get(EXTRA_SERVICE_MP) in shipping_label else self.no,
self.yes if shipping_label.has_declared_value() else self.no,
str(shipping_label.value).replace(".", ",") if shipping_label.value is not None else "",
str(shipping_label.invoice_number),
shipping_label.get_package_sequence(),
shipping_label.receiver.name[: self.max_receiver_name_size],
)
# noinspection PyTypeChecker
table.append(row)
if i % 2:
style.append(("BACKGROUND", (0, i), (-1, i), colors.lightgrey))
table_flow = Table(table, colWidths=self.col_widths, style=TableStyle(style))
w, h = table_flow.wrap(0, 0)
table_flow.drawOn(canvas, x1, y2 - h - 50 * mm)
示例6: getDrawing13
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import lightgrey [as 别名]
def getDrawing13():
'Test Various TTF Fonts'
def drawit(F,w=400,h=200,fontSize=12,slack=2,gap=5):
D = Drawing(w,h)
th = 2*gap + fontSize*1.2
gh = gap + .2*fontSize
y = h
maxx = 0
for fontName in F:
y -= th
text = fontName+asNative(b': I should be totally horizontal and enclosed in a box and end in alphabetagamma \xc2\xa2\xc2\xa9\xc2\xae\xc2\xa3\xca\xa5\xd0\x96\xd6\x83\xd7\x90\xd9\x82\xe0\xa6\x95\xce\xb1\xce\xb2\xce\xb3')
textWidth = stringWidth(text, fontName, fontSize)
maxx = max(maxx,textWidth+20)
D.add(
Group(Rect(8, y-gh, textWidth + 4, th, strokeColor=colors.red, strokeWidth=.5, fillColor=colors.lightgrey),
String(10, y, text, fontName=fontName, fontSize = fontSize)))
y -= 5
return maxx, h-y+gap, D
maxx, maxy, D = drawit(_FONTS)
if maxx>400 or maxy>200: _,_,D = drawit(_FONTS,maxx,maxy)
return D
##def getDrawing14():
## """This tests inherited properties. Each font should be as it says."""
## D = Drawing(400, 200)
##
## fontSize = 12
## D.fontName = 'Courier'
##
## g1 = Group(
## Rect(0, 0, 150, 20, fillColor=colors.yellow),
## String(5, 5, 'Inherited Courier', fontName=inherit, fontSize = fontSize)
## )
## D.add(g1)
##
## g2 = Group(g1, transform = translate(25,25))
## D.add(g2)
##
## g3 = Group(g2, transform = translate(25,25))
## D.add(g3)
##
## g4 = Group(g3, transform = translate(25,25))
## D.add(g4)
##
##
## return D
示例7: getDrawing13
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import lightgrey [as 别名]
def getDrawing13():
'Test Various TTF Fonts'
def drawit(F,w=400,h=200,fontSize=12,slack=2,gap=5):
D = Drawing(w,h)
th = 2*gap + fontSize*1.2
gh = gap + .2*fontSize
y = h
maxx = 0
for fontName in F:
y -= th
text = fontName+": I should be totally horizontal and enclosed in a box and end in alphabetagamma \xc2\xa2\xc2\xa9\xc2\xae\xc2\xa3\xca\xa5\xd0\x96\xd6\x83\xd7\x90\xd9\x82\xe0\xa6\x95\xce\xb1\xce\xb2\xce\xb3"
textWidth = stringWidth(text, fontName, fontSize)
maxx = max(maxx,textWidth+20)
D.add(
Group(Rect(8, y-gh, textWidth + 4, th, strokeColor=colors.red, strokeWidth=.5, fillColor=colors.lightgrey),
String(10, y, text, fontName=fontName, fontSize = fontSize)))
y -= 5
return maxx, h-y+gap, D
maxx, maxy, D = drawit(_FONTS)
if maxx>400 or maxy>200: _,_,D = drawit(_FONTS,maxx,maxy)
return D
##def getDrawing14():
## """This tests inherited properties. Each font should be as it says."""
## D = Drawing(400, 200)
##
## fontSize = 12
## D.fontName = 'Courier'
##
## g1 = Group(
## Rect(0, 0, 150, 20, fillColor=colors.yellow),
## String(5, 5, 'Inherited Courier', fontName=inherit, fontSize = fontSize)
## )
## D.add(g1)
##
## g2 = Group(g1, transform = translate(25,25))
## D.add(g2)
##
## g3 = Group(g2, transform = translate(25,25))
## D.add(g3)
##
## g4 = Group(g3, transform = translate(25,25))
## D.add(g4)
##
##
## return D