本文整理汇总了Python中reportlab.lib.colors.red方法的典型用法代码示例。如果您正苦于以下问题:Python colors.red方法的具体用法?Python colors.red怎么用?Python colors.red使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.lib.colors
的用法示例。
在下文中一共展示了colors.red方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: default_assertion_style
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [as 别名]
def default_assertion_style(depth, passed):
styles = [
RowStyle(
font=(
const.FONT if passed else const.FONT_BOLD,
const.FONT_SIZE_SMALL,
),
left_padding=const.INDENT * depth,
),
RowStyle(
text_color=colors.green if passed else colors.red,
start_column=const.LAST_COLUMN_IDX,
),
]
if not passed:
styles.append(RowStyle(background=colors.whitesmoke))
return styles
示例2: sample1
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [as 别名]
def sample1():
"Make up something from the individual Sectors"
d = Drawing(400, 400)
g = Group()
s1 = Wedge(centerx=200, centery=200, radius=150, startangledegrees=0, endangledegrees=120, radius1=100)
s1.fillColor=colors.red
s1.strokeColor=None
d.add(s1)
s2 = Wedge(centerx=200, centery=200, radius=150, startangledegrees=120, endangledegrees=240, radius1=100)
s2.fillColor=colors.green
s2.strokeColor=None
d.add(s2)
s3 = Wedge(centerx=200, centery=200, radius=150, startangledegrees=240, endangledegrees=260, radius1=100)
s3.fillColor=colors.blue
s3.strokeColor=None
d.add(s3)
s4 = Wedge(centerx=200, centery=200, radius=150, startangledegrees=260, endangledegrees=360, radius1=100)
s4.fillColor=colors.gray
s4.strokeColor=None
d.add(s4)
return d
示例3: sample1
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [as 别名]
def sample1():
"Make a typical pie chart with with one slice treated in a special way."
d = Drawing(400, 200)
pc = Pie()
pc.x = 150
pc.y = 50
pc.data = [10, 20, 30, 40, 50, 60]
pc.labels = ['a', 'b', 'c', 'd', 'e', 'f']
pc.slices.strokeWidth=1#0.5
pc.slices[3].popout = 20
pc.slices[3].strokeWidth = 2
pc.slices[3].strokeDashArray = [2,2]
pc.slices[3].labelRadius = 1.75
pc.slices[3].fontColor = colors.red
d.add(pc)
return d
示例4: demo
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [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
示例5: sample1c
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [as 别名]
def sample1c():
"Make sample legend."
d = Drawing(200, 100)
legend = Legend()
legend.alignment = 'right'
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
示例6: sample3
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [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
示例7: sample3a
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [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
示例8: getDrawing11
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [as 别名]
def getDrawing11():
'''test of anchoring'''
def makeSmiley(x, y, size, color):
"Make a smiley data item representation."
d = size
s = SmileyFace()
s.fillColor = color
s.x = x-d
s.y = y-d
s.size = d*2
return s
D = Drawing(400, 200) #, fillColor=colors.purple)
g = Group(transform=(1,0,0,1,0,0))
g.add(makeSmiley(100,100,10,colors.red))
g.add(Line(90,100,110,100,strokeColor=colors.green))
g.add(Line(100,90,100,110,strokeColor=colors.green))
D.add(g)
g = Group(transform=(2,0,0,2,100,-100))
g.add(makeSmiley(100,100,10,colors.blue))
g.add(Line(90,100,110,100,strokeColor=colors.green))
g.add(Line(100,90,100,110,strokeColor=colors.green))
D.add(g)
g = Group(transform=(2,0,0,2,0,0))
return D
示例9: _Flag_UK
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [as 别名]
def _Flag_UK(self):
s = _size
g = Group()
w = s*2
g.add(Rect(0, 0, w, s, fillColor = colors.navy, strokeColor = colors.black, strokeWidth=0))
g.add(Polygon([0,0, s*.225,0, w,s*(1-.1125), w,s, w-s*.225,s, 0, s*.1125], fillColor = colors.mintcream, strokeColor=None, strokeWidth=0))
g.add(Polygon([0,s*(1-.1125), 0, s, s*.225,s, w, s*.1125, w,0, w-s*.225,0], fillColor = colors.mintcream, strokeColor=None, strokeWidth=0))
g.add(Polygon([0, s-(s/15.0), (s-((s/10.0)*4)), (s*0.65), (s-(s/10.0)*3), (s*0.65), 0, s], fillColor = colors.red, strokeColor = None, strokeWidth=0))
g.add(Polygon([0, 0, (s-((s/10.0)*3)), (s*0.35), (s-((s/10.0)*2)), (s*0.35), (s/10.0), 0], fillColor = colors.red, strokeColor = None, strokeWidth=0))
g.add(Polygon([w, s, (s+((s/10.0)*3)), (s*0.65), (s+((s/10.0)*2)), (s*0.65), w-(s/10.0), s], fillColor = colors.red, strokeColor = None, strokeWidth=0))
g.add(Polygon([w, (s/15.0), (s+((s/10.0)*4)), (s*0.35), (s+((s/10.0)*3)), (s*0.35), w, 0], fillColor = colors.red, strokeColor = None, strokeWidth=0))
g.add(Rect(((s*0.42)*2), 0, width=(0.16*s)*2, height=s, fillColor = colors.mintcream, strokeColor = None, strokeWidth=0))
g.add(Rect(0, (s*0.35), width=w, height=s*0.3, fillColor = colors.mintcream, strokeColor = None, strokeWidth=0))
g.add(Rect(((s*0.45)*2), 0, width=(0.1*s)*2, height=s, fillColor = colors.red, strokeColor = None, strokeWidth=0))
g.add(Rect(0, (s*0.4), width=w, height=s*0.2, fillColor = colors.red, strokeColor = None, strokeWidth=0))
return g
示例10: _Flag_Austria
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [as 别名]
def _Flag_Austria(self):
s = _size # abbreviate as we will use this a lot
g = Group()
box = Rect(0, 0, s*2, s, fillColor = colors.mintcream,
strokeColor = colors.black, strokeWidth=0)
g.add(box)
redbox1 = Rect(0, 0, width=s*2.0, height=s/3.0,
fillColor = colors.red, strokeColor = None, strokeWidth=0)
g.add(redbox1)
redbox2 = Rect(0, ((s/3.0)*2.0), width=s*2.0, height=s/3.0,
fillColor = colors.red, strokeColor = None, strokeWidth=0)
g.add(redbox2)
return g
示例11: _Flag_Belgium
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [as 别名]
def _Flag_Belgium(self):
s = _size
g = Group()
box = Rect(0, 0, s*2, s,
fillColor = colors.black, strokeColor = colors.black, strokeWidth=0)
g.add(box)
box1 = Rect(0, 0, width=(s/3.0)*2.0, height=s,
fillColor = colors.black, strokeColor = None, strokeWidth=0)
g.add(box1)
box2 = Rect(((s/3.0)*2.0), 0, width=(s/3.0)*2.0, height=s,
fillColor = colors.gold, strokeColor = None, strokeWidth=0)
g.add(box2)
box3 = Rect(((s/3.0)*4.0), 0, width=(s/3.0)*2.0, height=s,
fillColor = colors.red, strokeColor = None, strokeWidth=0)
g.add(box3)
return g
示例12: _Flag_China
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [as 别名]
def _Flag_China(self):
s = _size
g = Group()
self._width = w = s*1.5
g.add(Rect(0, 0, w, s, fillColor=colors.red, strokeColor=None, strokeWidth=0))
def addStar(x,y,size,angle,g=g,w=s/20.0,x0=0,y0=s/2.0):
s = Star()
s.fillColor=colors.yellow
s.angle = angle
s.size = size*w*2
s.x = x*w+x0
s.y = y*w+y0
g.add(s)
addStar(5,5,3, 0)
addStar(10,1,1,36.86989765)
addStar(12,3,1,8.213210702)
addStar(12,6,1,16.60154960)
addStar(10,8,1,53.13010235)
return g
示例13: _Flag_Denmark
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [as 别名]
def _Flag_Denmark(self):
s = _size
g = Group()
self._width = w = s*1.4
box = Rect(0, 0, w, s,
fillColor = colors.red, strokeColor = colors.black, strokeWidth=0)
g.add(box)
whitebox1 = Rect(((s/5.0)*2), 0, width=s/6.0, height=s,
fillColor = colors.mintcream, strokeColor = None, strokeWidth=0)
g.add(whitebox1)
whitebox2 = Rect(0, ((s/2.0)-(s/12.0)), width=w, height=s/6.0,
fillColor = colors.mintcream, strokeColor = None, strokeWidth=0)
g.add(whitebox2)
return g
示例14: _Flag_Luxembourg
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [as 别名]
def _Flag_Luxembourg(self):
s = _size
g = Group()
box = Rect(0, 0, s*2, s,
fillColor = colors.mintcream, strokeColor = colors.black, strokeWidth=0)
g.add(box)
redbox = Rect(0, ((s/3.0)*2.0), width=s*2.0, height=s/3.0,
fillColor = colors.red, strokeColor = None, strokeWidth=0)
g.add(redbox)
bluebox = Rect(0, 0, width=s*2.0, height=s/3.0,
fillColor = colors.dodgerblue, strokeColor = None, strokeWidth=0)
g.add(bluebox)
return g
示例15: _Flag_Holland
# 需要导入模块: from reportlab.lib import colors [as 别名]
# 或者: from reportlab.lib.colors import red [as 别名]
def _Flag_Holland(self):
s = _size
g = Group()
box = Rect(0, 0, s*2, s,
fillColor = colors.mintcream, strokeColor = colors.black, strokeWidth=0)
g.add(box)
redbox = Rect(0, ((s/3.0)*2.0), width=s*2.0, height=s/3.0,
fillColor = colors.red, strokeColor = None, strokeWidth=0)
g.add(redbox)
bluebox = Rect(0, 0, width=s*2.0, height=s/3.0,
fillColor = colors.darkblue, strokeColor = None, strokeWidth=0)
g.add(bluebox)
return g