MCPcopy Create free account
hub / github.com/PageBot/PageBot / _drawNameLabel

Method _drawNameLabel

Lib/pagebot/elements/placer.py:77–86  ·  view source on GitHub ↗
(self, aa, view, p)

Source from the content-addressed store, hash-verified

75 Element.__init__(self, fill=fill, name=name, drawAfter=drawAfter, **kwargs)
76
77 def _drawNameLabel(self, aa, view, p):
78 x, y = point2D(p)
79 context = self.context
80 bs = context.newString(self.name, style=dict(fontSize=18,
81 textFill=(1, 0, 0)))
82 tw, th = bs.textSize
83 M = pt(8)
84 context.fill(color(1, 1, 1, 0.6))
85 context.rect(x + self.w/2 - tw/2 - M, y + self.h/2 - th/2 - M, tw + 2*M, th + 2*M)
86 context.text(bs, (x + self.w/2 - tw/2, y + self.h/2 - th/4))
87
88
89if __name__ == '__main__':

Callers

nothing calls this directly

Calls 7

point2DFunction · 0.90
ptFunction · 0.90
colorFunction · 0.90
newStringMethod · 0.80
fillMethod · 0.45
rectMethod · 0.45
textMethod · 0.45

Tested by

no test coverage detected