本文整理汇总了Python中reportlab.lib.colors.toColor函数的典型用法代码示例。如果您正苦于以下问题:Python toColor函数的具体用法?Python toColor怎么用?Python toColor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toColor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: drawBoundary
def drawBoundary(self,canv):
"draw the frame boundary as a rectangle (primarily for debugging)."
from reportlab.lib.colors import Color, CMYKColor, toColor
sb = self.showBoundary
ss = type(sb) in (type(''),type(()),type([])) or isinstance(sb,Color)
w = -1
if ss:
c = toColor(sb,self)
ss = c is not self
elif isinstance(sb,ShowBoundaryValue) and sb:
c = toColor(sb.color,self)
w = sb.width
ss = c is not self
if ss:
canv.saveState()
canv.setStrokeColor(c)
if w>=0:
canv.setLineWidth(w)
canv.rect(
self._x1,
self._y1,
self._x2 - self._x1,
self._y2 - self._y1
)
if ss: canv.restoreState()
开发者ID:pythonoob,项目名称:Rstext.me,代码行数:25,代码来源:frames.py
示例2: test1
def test1():
c = Canvas('figures.pdf')
f = Frame(inch, inch, 6*inch, 9*inch, showBoundary=1)
v = PlatPropFigure1()
v.captionTextColor = toColor('blue')
v.captionBackColor = toColor('lightyellow')
f.addFromList([v],c)
c.save()
开发者ID:AlonsoAyelen,项目名称:Voluntariado_veterinaria,代码行数:8,代码来源:figures.py
示例3: __init__
def __init__(self):
AreaLinePlot.__init__(self)
self.xValueAxis = NormalDateXValueAxis()
self.yValueAxis = AdjYValueAxis()
self.data=[(20030601,0.95,0.05,0.0),(20030701,0.95,0.05,0.0),(20030801,0.95,0.05,0.0),(20030901,0.95,0.05,0.0),(20031001,0.95,0.05,0.0),(20031101,0.95,0.05,0.0),(20031201,0.95,0.05,0.0),(20040101,0.95,0.05,0.0),(20040201,0.95,0.05,0.0),(20040301,0.95,0.05,0.0),(20040401,0.95,0.05,0.0),(20040501,0.95,0.05,0.0),(20040601,0.95,0.05,0.0),(20040701,0.95,0.05,0.0),(20040801,0.95,0.05,0.0),(20040901,0.95,0.05,0.0),(20041001,0.95,0.05,0.0),(20041101,0.95,0.05,0.0),(20041201,0.95,0.05,0.0),(20050101,0.95,0.05,0.0),(20050201,0.95,0.05,0.0),(20050301,0.95,0.05,0.0),(20050401,0.95,0.05,0.0),(20050501,0.95,0.05,0.0),(20050601,0.95,0.05,0.0),(20050701,0.95,0.05,0.0),(20050801,0.95,0.05,0.0),(20050901,0.95,0.05,0.0),(20051001,0.95,0.05,0.0),(20051101,0.95,0.05,0.0),(20051201,0.95,0.05,0.0),(20060101,0.95,0.05,0.0),(20060201,0.95,0.05,0.0),(20060301,0.95,0.05,0.0),(20060401,0.95,0.05,0.0),(20060501,0.95,0.05,0.0),(20060601,0.95,0.05,0.0),(20060701,0.95,0.05,0.0),(20060801,0.95,0.05,0.0),(20060901,0.95,0.05,0.0),(20061001,0.95,0.05,0.0),(20061101,0.95,0.05,0.0),(20061201,0.95,0.05,0.0),(20070101,0.95,0.05,0.0),(20070201,0.95,0.05,0.0),(20070301,0.95,0.05,0.0),(20070401,0.95,0.05,0.0),(20070501,0.95,0.05,0.0),(20070601,0.95,0.05,0.0),(20070701,0.95,0.05,0.0),(20070801,0.95,0.05,0.0),(20070901,0.95,0.05,0.0),(20071001,0.95,0.05,0.0),(20071101,0.95,0.05,0.0),(20071201,0.95,0.05,0.0),(20080101,0.95,0.05,0.0),(20080201,0.95,0.05,0.0),(20080301,0.95,0.05,0.0),(20080401,0.95,0.05,0.0),(20080501,0.95,0.05,0.0),(20080601,0.95,0.05,0.0),(20080701,0.95,0.05,0.0),(20080801,0.95,0.05,0.0),(20080901,0.95,0.05,0.0),(20081001,0.95,0.05,0.0),(20081101,0.95,0.05,0.0),(20081201,0.95,0.05,0.0),(20090101,0.95,0.05,0.0),(20090201,0.91,0.09,0.0),(20090301,0.91,0.09,0.0),(20090401,0.91,0.09,0.0),(20090501,0.91,0.09,0.0),(20090601,0.91,0.09,0.0),(20090701,0.91,0.09,0.0),(20090801,0.91,0.09,0.0),(20090901,0.91,0.09,0.0),(20091001,0.91,0.09,0.0),(20091101,0.91,0.09,0.0),(20091201,0.91,0.09,0.0),(20100101,0.91,0.09,0.0),(20100201,0.81,0.19,0.0),(20100301,0.81,0.19,0.0),(20100401,0.81,0.19,0.0),(20100501,0.81,0.19,0.0),(20100601,0.81,0.19,0.0),(20100701,0.81,0.19,0.0),(20100801,0.81,0.19,0.0),(20100901,0.81,0.19,0.0),(20101001,0.81,0.19,0.0),(20101101,0.81,0.19,0.0),(20101201,0.81,0.19,0.0),(20110101,0.81,0.19,0.0),(20110201,0.72,0.28,0.0),(20110301,0.72,0.28,0.0),(20110401,0.72,0.28,0.0),(20110501,0.72,0.28,0.0),(20110601,0.72,0.28,0.0),(20110701,0.72,0.28,0.0),(20110801,0.72,0.28,0.0),(20110901,0.72,0.28,0.0),(20111001,0.72,0.28,0.0),(20111101,0.72,0.28,0.0),(20111201,0.72,0.28,0.0),(20120101,0.72,0.28,0.0),(20120201,0.53,0.47,0.0),(20120301,0.53,0.47,0.0),(20120401,0.53,0.47,0.0),(20120501,0.53,0.47,0.0),(20120601,0.53,0.47,0.0),(20120701,0.53,0.47,0.0),(20120801,0.53,0.47,0.0),(20120901,0.53,0.47,0.0),(20121001,0.53,0.47,0.0),(20121101,0.53,0.47,0.0),(20121201,0.53,0.47,0.0),(20130101,0.53,0.47,0.0),(20130201,0.44,0.56,0.0),(20130301,0.44,0.56,0.0),(20130401,0.44,0.56,0.0),(20130501,0.44,0.56,0.0),(20130601,0.44,0.56,0.0),(20130701,0.44,0.56,0.0),(20130801,0.44,0.56,0.0),(20130901,0.44,0.56,0.0),(20131001,0.44,0.56,0.0),(20131101,0.44,0.56,0.0),(20131201,0.44,0.56,0.0),(20140101,0.44,0.56,0.0),(20140201,0.36,0.5,0.14),(20140301,0.36,0.5,0.14),(20140401,0.36,0.5,0.14),(20140501,0.36,0.5,0.14),(20140601,0.36,0.5,0.14),(20140701,0.36,0.5,0.14),(20140801,0.36,0.5,0.14),(20140901,0.36,0.5,0.14),(20141001,0.36,0.5,0.14),(20141101,0.36,0.5,0.14),(20141201,0.36,0.5,0.14),(20150101,0.36,0.5,0.14),(20150201,0.3,0.41,0.29),(20150301,0.3,0.41,0.29),(20150401,0.3,0.41,0.29),(20150501,0.3,0.41,0.29),(20150601,0.3,0.41,0.29),(20150701,0.3,0.41,0.29),(20150801,0.3,0.41,0.29),(20150901,0.3,0.41,0.29),(20151001,0.3,0.41,0.29),(20151101,0.3,0.41,0.29),(20151201,0.3,0.41,0.29),(20160101,0.3,0.41,0.29),(20160201,0.26,0.36,0.38),(20160301,0.26,0.36,0.38),(20160401,0.26,0.36,0.38),(20160501,0.26,0.36,0.38),(20160601,0.26,0.36,0.38),(20160701,0.26,0.36,0.38),(20160801,0.26,0.36,0.38),(20160901,0.26,0.36,0.38),(20161001,0.26,0.36,0.38),(20161101,0.26,0.36,0.38),(20161201,0.26,0.36,0.38),(20170101,0.26,0.36,0.38),(20170201,0.2,0.3,0.5),(20170301,0.2,0.3,0.5),(20170401,0.2,0.3,0.5),(20170501,0.2,0.3,0.5),(20170601,0.2,0.3,0.5),(20170701,0.2,0.3,0.5),(20170801,0.2,0.3,0.5),(20170901,0.2,0.3,0.5),(20171001,0.2,0.3,0.5),(20171101,0.2,0.3,0.5),(20171201,0.2,0.3,0.5),(20180101,0.2,0.3,0.5),(20180201,0.13,0.37,0.5),(20180301,0.13,0.37,0.5),(20180401,0.13,0.37,0.5),(20180501,0.13,0.37,0.5),(20180601,0.13,0.37,0.5),(20180701,0.13,0.37,0.5),(20180801,0.13,0.37,0.5),(20180901,0.13,0.37,0.5),(20181001,0.13,0.37,0.5),(20181101,0.13,0.37,0.5),(20181201,0.13,0.37,0.5),(20190101,0.13,0.37,0.5),(20190201,0.1,0.4,0.5),(20190301,0.1,0.4,0.5),(20190401,0.1,0.4,0.5),(20190501,0.1,0.4,0.5),(20190601,0.1,0.4,0.5),(20190701,0.1,0.4,0.5),(20190801,0.1,0.4,0.5),(20190901,0.1,0.4,0.5),(20191001,0.1,0.4,0.5),(20191101,0.1,0.4,0.5),(20191201,0.1,0.4,0.5),(20200101,0.1,0.4,0.5)]
self.yValueAxis.requiredRange = None
self.yValueAxis.leftAxisPercent = 0
self.yValueAxis.leftAxisOrigShiftMin = 0
self.yValueAxis.leftAxisOrigShiftIPC = 0
self.lines[0].strokeColor = colors.toColor(0x0033cc)
self.lines[1].strokeColor = colors.toColor(0x99c3ff)
self.lines[2].strokeColor = colors.toColor(0xCC0033)
开发者ID:SongJLG,项目名称:johan-doc,代码行数:12,代码来源:lineplots.py
示例4: getCaptcha
def getCaptcha(n=5,fontName='Courier',fontSize=14,text=None,fillColor=None):
'''return n random chars in a string and in a byte string structured
as a GIF image'''
from reportlab.graphics.shapes import Drawing, Group, String, \
rotate, skewX, skewY, mmult, translate, Rect
if not text:
from random import randint, uniform
text=''.join([_allowed[randint(0,_mx)] for i in range(n)])
else:
uniform = lambda l,h: 0.5*(l+h)
n = len(text)
baseline = 0
x = 0
G0 = Group()
for c in text:
x += 1
A = translate(x,uniform(baseline-5,baseline+5))
A = mmult(A,rotate(uniform(-15,15)))
A = mmult(A,skewX(uniform(-8,8)))
A = mmult(A,skewY(uniform(-8,8)))
G = Group(transform=A)
G.add(String(0,0,c,fontname=fontName,fontSize=fontSize))
G0.add(G)
x0,y0,x1,y1 = G0.getBounds()
x = 1+x1
G0.transform=translate(2-x0,2-y0)
W = 4+x1-x0
H = 4+y1-y0
D = Drawing(W,H)
if fillColor:
from reportlab.lib.colors import toColor
D.add(Rect(0,0,W,H, fillColor = toColor(fillColor),strokeColor=None))
D.add(G0)
return text, D.asString('gif')
开发者ID:AndyKovv,项目名称:hostel,代码行数:34,代码来源:captcha.py
示例5: _rgbFind
def _rgbFind(self,color):
"see if it matches any existing color in my list"
C = self.cmykColors
if isinstance(color,(list,tuple)):
if len(color)==3: color = Color(color[0],color[1],color[2])
elif len(color)==4: color = CMYKColor(color[0],color[1],color[2],color[3])
else: raise ValueError("bad color %s"%repr(color))
isCMYK = isinstance(color, CMYKColor)
if not isCMYK:
if isinstance(color,str):
color = toColor(color)
if colorDistance(color,black)<1e-8:
isCMYK = 1
color = PCMYKColor(0,0,0,100,100)
elif colorDistance(color,white)<1e-8:
isCMYK = 1
color = PCMYKColor(0,0,0,0,100)
rgb = color.red, color.green, color.blue
if isCMYK:
if color not in C: C.append(color)
return self._setCMYKColor(color)
else:
for c in C:
if (c.red, c.green, c.blue) == rgb:
return self._setCMYKColor(c)
return '%s setrgbcolor' % fp_str(rgb)
开发者ID:AndyKovv,项目名称:hostel,代码行数:27,代码来源:renderPS_SEP.py
示例6: __init__
def __init__(self, width, height, caption="",
captionFont="Times-Italic", captionSize=12,
background=None,
captionTextColor=toColor('black'),
captionBackColor=None,
border=1,
spaceBefore=12,
spaceAfter=12,
captionGap=None,
):
Flowable.__init__(self)
self.width = width
self.figureHeight = height
self.caption = caption
self.captionFont = captionFont
self.captionSize = captionSize
self.captionTextColor = captionTextColor
self.captionBackColor = captionBackColor
self.captionGap = captionGap
self._captionData = None
self.captionHeight = 0 # work out later
self.background = background
self.border = border
self.spaceBefore = spaceBefore
self.spaceAfter = spaceAfter
self._getCaptionPara() #Larry Meyn's fix - otherwise they all get the number of the last chapter.
开发者ID:AceZOfZSpades,项目名称:RankPanda,代码行数:27,代码来源:figures.py
示例7: getColor
def getColor(value, default=None):
"""
Convert to color value.
This returns a Color object instance from a text bit.
"""
if isinstance(value, Color):
return value
value = str(value).strip().lower()
if value == "transparent" or value == "none":
return default
if value in COLOR_BY_NAME:
return COLOR_BY_NAME[value]
if value.startswith("#") and len(value) == 4:
value = "#" + value[1] + value[1] + \
value[2] + value[2] + value[3] + value[3]
elif rgb_re.search(value):
# e.g., value = "<css function: rgb(153, 51, 153)>", go figure:
r, g, b = [int(x) for x in rgb_re.search(value).groups()]
value = "#%02x%02x%02x" % (r, g, b)
else:
# Shrug
pass
return toColor(value, default) # Calling the reportlab function
开发者ID:ebar0n,项目名称:xhtml2pdf,代码行数:25,代码来源:util.py
示例8: translate
def translate(self, color=None, colour=None):
""" translate(self, color)
o color Color defined as an int, a tuple of three ints 0->255
or a tuple of three floats 0 -> 1, or a string giving
one of the named colors defined by ReportLab, or a
ReportLab color object (returned as is).
(This argument is overridden by a backwards compatible
argument with UK spelling, colour).
Returns a colors.Color object, determined semi-intelligently
depending on the input values
"""
#Let the UK spelling (colour) override the USA spelling (color)
if colour is not None:
color = colour
if color is None:
raise ValueError("Passed color (or colour) must be a valid color type")
elif isinstance(color, int):
color = self.scheme_color(color)
elif isinstance(color, colors.Color):
return color
elif isinstance(color, basestring):
#Assume its a named reportlab color like "red".
color = colors.toColor(color)
elif isinstance(color, tuple) and isinstance(color[0], float):
color = self.float1_color(color)
elif isinstance(color, tuple) and isinstance(color[0], int):
color = self.int255_color(color)
return color
开发者ID:Glchriste,项目名称:Paralog-Network,代码行数:32,代码来源:_Colors.py
示例9: setFillColor
def setFillColor(me, aColor):
"""Takes a color object, allowing colors to be referred to by name"""
color = toColor( aColor)
if color:
me.recorder.SetTextForeground( *color.bitmap_rgb())
else:
raise 'Unknown color', str(aColor)
开发者ID:svilendobrev,项目名称:rl2wx,代码行数:7,代码来源:textobject.py
示例10: setStrokeColor
def setStrokeColor(self, aColor, alpha=None):
"""Takes a color object, allowing colors to be referred to by name"""
if self._enforceColorSpace:
aColor = self._enforceColorSpace(aColor)
if isinstance(aColor, CMYKColor):
d = aColor.density
c, m, y, k = (d * aColor.cyan, d * aColor.magenta, d * aColor.yellow, d * aColor.black)
self._strokeColorObj = aColor
name = self._checkSeparation(aColor)
if name:
self._code.append("/%s CS %s SCN" % (name, fp_str(d)))
else:
self._code.append("%s K" % fp_str(c, m, y, k))
elif isinstance(aColor, Color):
rgb = (aColor.red, aColor.green, aColor.blue)
self._strokeColorObj = aColor
self._code.append("%s RG" % fp_str(rgb))
elif isinstance(aColor, (tuple, list)):
l = len(aColor)
if l == 3:
self._strokeColorObj = aColor
self._code.append("%s RG" % fp_str(aColor))
elif l == 4:
self._fillColorObj = aColor
self._code.append("%s K" % fp_str(aColor))
else:
raise ValueError("Unknown color %r" % aColor)
elif isinstance(aColor, basestring):
self.setStrokeColor(toColor(aColor))
else:
raise ValueError("Unknown color %r" % aColor)
if alpha is not None:
self.setStrokeAlpha(alpha)
elif getattr(aColor, "alpha", None) is not None:
self.setStrokeAlpha(aColor.alpha)
开发者ID:HiTechnologia,项目名称:basri-openerp-rtl,代码行数:35,代码来源:textobject.py
示例11: __init__
def __init__(self, width, height, caption="",
captionFont="Times-Italic", captionSize=12,
background=None,
captionTextColor=toColor('black'),
captionBackColor=None,
border=1,
spaceBefore=12,
spaceAfter=12,
captionGap=None,
):
Flowable.__init__(self)
self.width = width
self.figureHeight = height
self.caption = caption
self.captionFont = captionFont
self.captionSize = captionSize
self.captionTextColor = captionTextColor
self.captionBackColor = captionBackColor
self.captionGap = captionGap
self._captionData = None
self.captionHeight = 0 # work out later
self.background = background
self.border = border
self.spaceBefore = spaceBefore
self.spaceAfter = spaceAfter
开发者ID:jwheare,项目名称:digest,代码行数:25,代码来源:figures.py
示例12: __init__
def __init__(self, width, height, caption="",
captionFont=_baseFontNameI, captionSize=12,
background=None,
captionTextColor=toColor('black'),
captionBackColor=None,
border=None,
spaceBefore=12,
spaceAfter=12,
captionGap=None,
captionAlign='centre',
captionPosition='bottom',
hAlign='CENTER',
):
Flowable.__init__(self)
self.width = width
self.figureHeight = height
self.caption = caption
self.captionFont = captionFont
self.captionSize = captionSize
self.captionTextColor = captionTextColor
self.captionBackColor = captionBackColor
self.captionGap = captionGap or 0.5*captionSize
self.captionAlign = captionAlign
self.captionPosition = captionPosition
self._captionData = None
self.captionHeight = 0 # work out later
self.background = background
self.border = border
self.spaceBefore = spaceBefore
self.spaceAfter = spaceAfter
self.hAlign=hAlign
self._getCaptionPara() #Larry Meyn's fix - otherwise they all get the number of the last chapter.
开发者ID:AlonsoAyelen,项目名称:Voluntariado_veterinaria,代码行数:32,代码来源:figures.py
示例13: get_color_as_hexa
def get_color_as_hexa(str_value, default='#000000'):
value = str_value.strip()
if value.startswith('rgb'):
value = value.lstrip('rgb(').rstrip(')').split(',')
value = [ int(i) for i in value ]
tmp = []
if len(value) == 3:
# RGB
for i in value:
if i < 256:
tmp.append('%02x' % i)
else:
print '(WW) the color "%s" is not well formed ' % str_value
return default
value = '#%s' % ''.join(tmp)
elif value.startswith('#'):
value_length = len(value)
if value_length == 4:
# #aba -> #aabbaa
r = value[1] * 2
g = value[2] * 2
b = value[3] * 2
value = '#%s%s%s' % (r, g, b)
elif value_length != 7:
print '(WW) the color "%s" is not well formed ' % str_value
else:
# Warning getAllNamedColors() uses a singleton
value = ('#%02x%02x%02x' %
colors.toColor(value, colors.black).bitmap_rgb())
return value
开发者ID:kennym,项目名称:itools,代码行数:30,代码来源:utils.py
示例14: _setCellStyle
def _setCellStyle(cellStyles, i, j, op, values):
#new = CellStyle('<%d, %d>' % (i,j), cellStyles[i][j])
#cellStyles[i][j] = new
## modify in place!!!
new = cellStyles[i][j]
if op == 'FONT':
n = len(values)
new.fontname = values[0]
if n>1:
new.fontsize = values[1]
if n>2:
new.leading = values[2]
else:
new.leading = new.fontsize*1.2
elif op in ('FONTNAME', 'FACE'):
new.fontname = values[0]
elif op in ('SIZE', 'FONTSIZE'):
new.fontsize = values[0]
elif op == 'LEADING':
new.leading = values[0]
elif op == 'TEXTCOLOR':
new.color = colors.toColor(values[0], colors.Color(0,0,0))
elif op in ('ALIGN', 'ALIGNMENT'):
new.alignment = values[0]
elif op == 'VALIGN':
new.valign = values[0]
elif op == 'LEFTPADDING':
new.leftPadding = values[0]
elif op == 'RIGHTPADDING':
new.rightPadding = values[0]
elif op == 'TOPPADDING':
new.topPadding = values[0]
elif op == 'BOTTOMPADDING':
new.bottomPadding = values[0]
开发者ID:eaudeweb,项目名称:naaya,代码行数:34,代码来源:tables.py
示例15: setFillColor
def setFillColor(self, aColor, alpha=None):
"""Takes a color object, allowing colors to be referred to by name"""
if self._enforceColorSpace:
aColor = self._enforceColorSpace(aColor)
if isinstance(aColor, CMYKColor):
d = aColor.density
c,m,y,k = (d*aColor.cyan, d*aColor.magenta, d*aColor.yellow, d*aColor.black)
self._fillColorObj = aColor
name = self._checkSeparation(aColor)
if name:
self._code.append('/%s cs %s scn' % (name,fp_str(d)))
else:
self._code.append('%s k' % fp_str(c, m, y, k))
elif isinstance(aColor, Color):
rgb = (aColor.red, aColor.green, aColor.blue)
self._fillColorObj = aColor
self._code.append('%s rg' % fp_str(rgb) )
elif isinstance(aColor,(tuple,list)):
l = len(aColor)
if l==3:
self._fillColorObj = aColor
self._code.append('%s rg' % fp_str(aColor) )
elif l==4:
self._fillColorObj = aColor
self._code.append('%s k' % fp_str(aColor))
else:
raise ValueError('Unknown color %r' % aColor)
elif isStr(aColor):
self.setFillColor(toColor(aColor))
else:
raise ValueError('Unknown color %r' % aColor)
if alpha is not None:
self.setFillAlpha(alpha)
elif getattr(aColor, 'alpha', None) is not None:
self.setFillAlpha(aColor.alpha)
开发者ID:abdounasser202,项目名称:Achouka,代码行数:35,代码来源:textobject.py
示例16: setStrokeColor
def setStrokeColor(me, aColor):
color = toColor( aColor)
if color:
me._strokeColorRGB = color.bitmap_rgb()
me._set_pen()
else:
raise 'Unknown color', str(aColor)
开发者ID:svilendobrev,项目名称:rl2wx,代码行数:7,代码来源:canvas.py
示例17: test2
def test2(self):
"Test toColor function on half a dozen ways to say 'red'."
allRed = [colors.red, [1, 0, 0], (1, 0, 0), "red", "RED", "0xFF0000", "0xff0000"]
for thing in allRed:
assert colors.toColor(thing) == colors.red
开发者ID:radical-software,项目名称:radicalspam,代码行数:7,代码来源:test_lib_colors.py
示例18: _toColor
def _toColor(s):
from reportlab.lib.colors import toColor
if s in ['','none','None',None]:
return None
try:
return toColor(s)
except:
raise ValueError('Bad color value %r' % s)
开发者ID:AndyKovv,项目名称:hostel,代码行数:8,代码来源:mymodule.py
示例19: test2
def test2(self):
"Test toColor function on half a dozen ways to say 'red'."
allRed = [colors.red, [1, 0, 0], (1, 0, 0),
'red', 'RED', '0xFF0000', '0xff0000','rgb(255,0,0)']
for thing in allRed:
assert colors.toColor(thing) == colors.red,"colors.toColor(%s)-->%s != colors.red(%s)" % (ascii(thing),ascii(colors.toColor(thing)),colors.red)
开发者ID:QGIS-Unibern,项目名称:MasterPlugin,代码行数:8,代码来源:test_lib_colors.py
示例20: setFillColor
def setFillColor(me, aColor):
'''Takes a color object, allowing colors to be referred to by name'''
color = toColor( aColor)
if color:
me._fillColorRGB = color.bitmap_rgb()
me._set_brush()
else:
raise 'Unknown color', str(aColor)
开发者ID:svilendobrev,项目名称:rl2wx,代码行数:9,代码来源:canvas.py
注:本文中的reportlab.lib.colors.toColor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论