本文整理汇总了Python中elementtree.ElementTree.Element.attrib['stroke']方法的典型用法代码示例。如果您正苦于以下问题:Python Element.attrib['stroke']方法的具体用法?Python Element.attrib['stroke']怎么用?Python Element.attrib['stroke']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elementtree.ElementTree.Element
的用法示例。
在下文中一共展示了Element.attrib['stroke']方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: draw_split
# 需要导入模块: from elementtree.ElementTree import Element [as 别名]
# 或者: from elementtree.ElementTree.Element import attrib['stroke'] [as 别名]
def draw_split(self):
""" Draws a set of hashmarks at the desired level """
gelem = Element("g") # create a group
level = self.sval
if level == 'H':
y = self.y-self.height
elif level == 'Z':
y = self.y - self.height/2.0
else:
y = self.y
l0elem = Element("line")
l0elem.attrib['x1'] = str(self.x)
l0elem.attrib['y1'] = str(y);
l0elem.attrib['x2'] = str(self.x + 3.5 * self.period/8.0)
l0elem.attrib['y2'] = str(y);
l0elem.attrib['stroke'] = "black"
gelem.append(l0elem)
l1elem = Element("line")
l1elem.attrib['x1'] = str(self.x + 3.0* self.period/8.0)
l1elem.attrib['y1'] = str(y + self.height/4.0);
l1elem.attrib['x2'] = str(self.x + 4*self.period/8.0)
l1elem.attrib['y2'] = str(y - self.height/4.0);
l1elem.attrib['stroke'] = "black"
gelem.append(l1elem)
l2elem = Element("line")
l2elem.attrib['x1'] = str(self.x + 4.0* self.period/8.0)
l2elem.attrib['y1'] = str(y + self.height/4.0);
l2elem.attrib['x2'] = str(self.x + 5.0*self.period/8.0)
l2elem.attrib['y2'] = str(y - self.height/4.0);
l2elem.attrib['stroke'] = "black"
gelem.append(l2elem)
l3elem = Element("line")
l3elem.attrib['x1'] = str(self.x + 4.5*self.period/8.0)
l3elem.attrib['y1'] = str(y);
l3elem.attrib['x2'] = str(self.x + self.period)
l3elem.attrib['y2'] = str(y);
l3elem.attrib['stroke'] = "black"
gelem.append(l3elem)
self.x += self.period
return gelem
示例2: draw_bus
# 需要导入模块: from elementtree.ElementTree import Element [as 别名]
# 或者: from elementtree.ElementTree.Element import attrib['stroke'] [as 别名]
def draw_bus(self, title, color):
gelem = Element("g") # create a group
oelem = Element("path")
otuple = (self.x, self.y - self.height/2, self.period/8, -self.height/2, 6*self.period/8.0, self.period/8.0, self.height/2, -self.period/8, self.height/2.0, -6*self.period/8.0)
oelem.attrib['d']= "M%f,%f l%f,%f h%f l%f,%f l%f,%f h%f Z" % otuple
oelem.attrib['stroke'] = "black"
oelem.attrib['fill'] = color
oelem.attrib['stroke-linecap'] = "square"
gelem.append(oelem)
telem = Element("text")
telem.attrib['x'] = "%f" % (self.x + self.period/2)
telem.attrib['y'] = "%f" % (self.y - self.height/4.0-0.3)
telem.attrib['font-family'] = "Helvetica"
telem.attrib['font-size'] = "%f" % (self.height/1.9)
telem.attrib['text-anchor'] = "middle"
telem.text = title
gelem.append(telem)
self.x += self.period
self.sval = 'Z'
return gelem
示例3: draw_clock
# 需要导入模块: from elementtree.ElementTree import Element [as 别名]
# 或者: from elementtree.ElementTree.Element import attrib['stroke'] [as 别名]
def draw_clock(self):
elem = Element("path")
ptuple = (self.x, self.y, self.period/2, -self.height, self.period/2, self.height)
elem.attrib['d'] = "M%f,%f h%f v%f h%f v%f" % ptuple
elem.attrib['stroke'] = "black"
elem.attrib['fill'] = "none"
elem.attrib['stroke-linecap'] = "square"
self.x += self.period
self.sval = 'L'
return elem
示例4: timinggrid
# 需要导入模块: from elementtree.ElementTree import Element [as 别名]
# 或者: from elementtree.ElementTree.Element import attrib['stroke'] [as 别名]
def timinggrid(self):
"""
This function uses the signalcnt, cycles, period, height, and spacing
to draw the light lines that will be the clock lines.
"""
gelem = Element("g") # create a group
for i in range(int(self.cycles)):
lelem = Element("line")
lelem.attrib['x1'] = str(i*self.period + self.period/2.0 + self.xzero)
lelem.attrib['y1'] = str(0);
lelem.attrib['x2'] = str(i*self.period + self.period/2.0 + self.xzero)
lelem.attrib['y2'] = str(self.signalcnt*(self.height + self.signalspacing) + self.signalspacing)
lelem.attrib['stroke'] = "grey"
lelem.attrib['stroke-width'] = "0.5"
gelem.append(lelem)
self.svgelem.append(gelem)
self.svgelem.append(self.signalselem)
示例5: draw_low
# 需要导入模块: from elementtree.ElementTree import Element [as 别名]
# 或者: from elementtree.ElementTree.Element import attrib['stroke'] [as 别名]
def draw_low(self):
elem = Element("path")
if self.sval == 'H':
starty = self.y - self.height
elif self.sval == 'Z':
starty = self.y - self.height/2
else:
starty = self.y
ptuple = (self.x, starty, self.period/8, self.y-starty, 7*self.period/8)
elem.attrib['d'] = "M%f,%f l%f, %f h%f" % ptuple
elem.attrib['stroke'] = "black"
elem.attrib['fill'] = "none"
elem.attrib['stroke-linecap'] = "square"
self.x += self.period
self.sval = 'L'
return elem