当前位置: 首页>>代码示例>>Python>>正文


Python Element.attrib['font-size']方法代码示例

本文整理汇总了Python中elementtree.ElementTree.Element.attrib['font-size']方法的典型用法代码示例。如果您正苦于以下问题:Python Element.attrib['font-size']方法的具体用法?Python Element.attrib['font-size']怎么用?Python Element.attrib['font-size']使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在elementtree.ElementTree.Element的用法示例。


在下文中一共展示了Element.attrib['font-size']方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: draw_bus

# 需要导入模块: from elementtree.ElementTree import Element [as 别名]
# 或者: from elementtree.ElementTree.Element import attrib['font-size'] [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
开发者ID:somaproject,项目名称:doctools,代码行数:28,代码来源:timing.py

示例2: draw_name

# 需要导入模块: from elementtree.ElementTree import Element [as 别名]
# 或者: from elementtree.ElementTree.Element import attrib['font-size'] [as 别名]
 def draw_name(self):
     """ the name is to the left of the original draw point"""
     elem = Element("text")
     elem.attrib['x'] =  "%f" %  (self.startx -4)
     elem.attrib['y'] = "%f" % (self.starty-4)
     elem.attrib['font-family'] = "Helvetica"
     elem.attrib['font-size'] = "%f" % (self.height/1.4)
     elem.attrib['text-anchor'] = "end"
     elem.text = self.name
     return elem
开发者ID:somaproject,项目名称:doctools,代码行数:12,代码来源:timing.py


注:本文中的elementtree.ElementTree.Element.attrib['font-size']方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。