本文整理汇总了Python中reportlab.graphics.charts.textlabels.Label.boxStrokeWidth方法的典型用法代码示例。如果您正苦于以下问题:Python Label.boxStrokeWidth方法的具体用法?Python Label.boxStrokeWidth怎么用?Python Label.boxStrokeWidth使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类reportlab.graphics.charts.textlabels.Label
的用法示例。
在下文中一共展示了Label.boxStrokeWidth方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _makeProtoLabel
# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import boxStrokeWidth [as 别名]
def _makeProtoLabel(self):
"Return a label prototype for further modification."
protoLabel = Label()
protoLabel.dx = 0
protoLabel.dy = 0
protoLabel.boxStrokeWidth = 0.1
protoLabel.boxStrokeColor = colors.black
protoLabel.boxFillColor = colors.yellow
# protoLabel.text = 'Hello World!' # Does not work as expected.
return protoLabel
示例2: draw_hex
# 需要导入模块: from reportlab.graphics.charts.textlabels import Label [as 别名]
# 或者: from reportlab.graphics.charts.textlabels.Label import boxStrokeWidth [as 别名]
def draw_hex(self):
print 'Reporting Hex'
story = []
for p in self.world.packets:
pl,t = p.build_ps()
XSTART = 0
XDSTART = 210
y = 0.0
XMUL= 100.0
YMUL = 10.0
larg = 16
YDUMP = PAGE_HEIGHT*0.80/YMUL - 10
YDUMP = 0
canvas = shapes.Drawing(500, 100)
# canvas.add(shapes.Rect(0,0, 500, PAGE_HEIGHT, fillColor=colors.yellow))
backcolor=colgen(0.6, 0.8, 1.0)
forecolor=colgen(0.2, 0.5, 0.8)
def hexstr(x):
s = []
for c in x:
s.append("%02x" % ord(c))
return " ".join(s)
my_y = 0
shift = 0
last_x = 0
while t:
bkcol = backcolor.next()
proto,fields = t.pop()
l = Label()
l.setText(proto.name)
l.boxAnchor = 'w'
l.boxStrokeColor = colors.gray
bc = colors.Color(bkcol[0], bkcol[1], bkcol[2] )
l.boxFillColor = bc
l.setOrigin(XSTART, (YDUMP-y)*YMUL)
canvas.add(l)
my_y = y
for fname, fval, fdump in fields:
y += 1.5
col = forecolor.next()
l = Label()
l.boxAnchor = 'w'
l.setText(fname.name)
l.setOrigin(XSTART + (0.1 * XMUL), (YDUMP-y)*YMUL)
canvas.add(l)
if fval is not None:
if len(fval) > 24:
fval = fval[:21]+"..."
else:
fval=""
l = Label()
l.setText(fval)
xlabel, ylabel = XSTART+(1.5*XMUL), (YDUMP-y)*YMUL
l.setOrigin(xlabel, ylabel)
l.boxStrokeWidth = 2
l.boxAnchor = 'e'
canvas.add(l)
first = True
while fdump:
dmp, fdump = fdump[:larg-shift],fdump[larg-shift:]
l = Label()
l.boxAnchor = 'w'
l.fontName = 'Courier'
l.boxFillColor = colors.Color(bkcol[0], bkcol[1], bkcol[2])
l.boxStrokeColor = colors.Color(col[0], col[1], col[2])
l.boxStrokeWidth = 2
xdump, ydump = XDSTART+ last_x * 0.06*XMUL, (YDUMP-my_y)*YMUL
l.setOrigin(xdump, ydump)
h = hexstr(dmp)
l.setText(h)
canvas.add(l)
if first:
link = shapes.Line(xdump, ydump, xlabel, ylabel, strokeColor=colors.Color(col[0], col[1], col[2]), strokeWidth=1)
canvas.add(link)
first = False
shift += len(dmp)
last_x += len(h) +1
if shift >= larg:
shift = 0
last_x = 0
my_y += 2
y += 2
scale = 0.7
canvas.shift(0, y * YMUL*scale)
canvas.height = min(y * YMUL *scale , PAGE_HEIGHT*0.80)
canvas.scale(scale, scale)
# para = Paragraph('<a name="hex%d"/>'%p.number + \
# '<a href="#summary%d">(%d) %s</a>' % (p.number, p.number, p.description), styles['Normal'])
# story.append([[para, Spacer(1,10), canvas]])
para = Paragraph('<a href="#summary%d">(%d) %s</a>' % (p.number, p.number, p.description), styles['Normal'])
story.append([[para, Spacer(1,10), canvas]])
t = Table(story)
t.setStyle(TableStyle([
('INNERGRID', (0,0), (-1,-1), 0.1, colors.black),
('BOX', (0,0), (-1,-1), 0.1, colors.black),
#.........这里部分代码省略.........