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


Python DOM.appendChild方法代码示例

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


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

示例1: setWidget

# 需要导入模块: import DOM [as 别名]
# 或者: from DOM import appendChild [as 别名]
    def setWidget(self, index, w):
        """ Sets one of the contained widgets.
            @param index the index, only 0 and 1 are valid
            @param w the widget
        """
        oldWidget = self.widgets[index]

        if oldWidget == w:
          return

        if (w != None):
          w.removeFromParent()

        # Remove the old child.
        if (oldWidget != None):
          # Orphan old.
          orphan(oldWidget)
          # Physical detach old.
          DOM.removeChild(self.elements[index], oldWidget.getElement())

        # Logical detach old / attach new.
        self.widgets[index] = w

        if (w != None):
            # Physical attach new.
            DOM.appendChild(self.elements[index], w.getElement())

            # Adopt new.
            self.adopt(w)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:31,代码来源:splitpanel.py

示例2: __init__

# 需要导入模块: import DOM [as 别名]
# 或者: from DOM import appendChild [as 别名]
    def __init__(self, rowStyles=DEFAULT_ROW_STYLENAMES,
                             containerIndex=1) :
        """ Creates a new panel using the specified style names to
            apply to each row.  Each row will contain three cells
            (Left, Center, and Right). The Center cell in the
            containerIndex row will contain the {@link Widget}.
            
            @param rowStyles an array of style names to apply to each row
            @param containerIndex the index of the container row
        """
      
        SimplePanel.__init__(self, DOM.createTable())

        # Add a tbody
        self.table = self.getElement()
        self.tbody = DOM.createTBody()
        DOM.appendChild(self.table, self.tbody)
        DOM.setIntAttribute(self.table, "cellSpacing", 0)
        DOM.setIntAttribute(self.table, "cellPadding", 0)

        # Add each row
        for i in range(len(rowStyles)): 
            row = self.createTR(rowStyles[i])
            DOM.appendChild(self.tbody, row)
            if i == containerIndex:
                self.containerElem = DOM.getFirstChild(DOM.getChild(row, 1))

        # Set the overall style name
        self.setStyleName(self.DEFAULT_STYLENAME)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:31,代码来源:decoratorpanel.py

示例3: createTD

# 需要导入模块: import DOM [as 别名]
# 或者: from DOM import appendChild [as 别名]
 def createTD(self, styleName) :
     """ Create a new table cell with a specific style name.
      
         @param styleName the style name
         @return the new cell {@link Element}
     """
     tdElem = DOM.createTD()
     inner = DOM.createDiv()
     DOM.appendChild(tdElem, inner)
     self.setStyleName(tdElem, styleName)
     self.setStyleName(inner, styleName + "Inner")
     print "createTd", styleName
     return tdElem
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:15,代码来源:decoratorpanel.py

示例4: __init__

# 需要导入模块: import DOM [as 别名]
# 或者: from DOM import appendChild [as 别名]
    def __init__(self, width, height):
        self.context = None

        self.setElement(DOM.createDiv())
        canvas = DOM.createElement("canvas")
        self.setWidth(width)
        self.setHeight(height)

        canvas.width = width
        canvas.height = height

        DOM.appendChild(self.getElement(), canvas)
        self.setStyleName("gwt-Canvas")

        self.init()

        self.context.fillStyle = "black"
        self.context.strokeStyle = "black"
开发者ID:AwelEshetu,项目名称:cwm,代码行数:20,代码来源:Canvas.py

示例5: buildDOM

# 需要导入模块: import DOM [as 别名]
# 或者: from DOM import appendChild [as 别名]
    def buildDOM(self):
        topDiv = self.getWidgetElement(TOP)
        bottomDiv = self.getWidgetElement(BOTTOM)
        splitDiv = self.getSplitElement()

        DOM.appendChild(self.getElement(), self.container)

        DOM.appendChild(self.container, topDiv)
        DOM.appendChild(self.container, splitDiv)
        DOM.appendChild(self.container, bottomDiv)

        # The style name is placed on the table rather than splitElem
        # to allow the splitter to be styled without interfering
        # with layout.

        thumb_html = '<img src="splitPanelThumb.png" />'
        DOM.setInnerHTML(splitDiv, "<div class='vsplitter' " +
                                   "style='text-align:center'>" +
                                   thumb_html + "</div>")

        self.addScrolling(topDiv)
        self.addScrolling(bottomDiv)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:24,代码来源:vertsplitpanel.py

示例6: createTR

# 需要导入模块: import DOM [as 别名]
# 或者: from DOM import appendChild [as 别名]
 def createTR(self, styleName) :
     """ Create a new row with a specific style name. The row
         will contain three cells (Left, Center, and Right), each
         prefixed with the specified style name.
      
         This method allows Widgets to reuse the code on a DOM
         level, without creating a DecoratorPanel Widget.
      
         @param styleName the style name
         @return the new row {@link Element}
     """
     trElem = DOM.createTR()
     self.setStyleName(trElem, styleName)
     DOM.appendChild(trElem, self.createTD(styleName + "Left"))
     DOM.appendChild(trElem, self.createTD(styleName + "Center"))
     DOM.appendChild(trElem, self.createTD(styleName + "Right"))
     return trElem
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:19,代码来源:decoratorpanel.py

示例7: getBodyElement

# 需要导入模块: import DOM [as 别名]
# 或者: from DOM import appendChild [as 别名]
import DOM

def getBodyElement():
    JS(""" return $doc.body; """)

def write(text):
    global data, element
    data += text
    DOM.setInnerHTML(element, data)

def writebr(text):
    write(text + r"<BR>\n")

data = ""
element = DOM.createDiv()
DOM.appendChild(getBodyElement(), element)
开发者ID:pombredanne,项目名称:pyjamas-desktop,代码行数:18,代码来源:write.py

示例8: add

# 需要导入模块: import DOM [as 别名]
# 或者: from DOM import appendChild [as 别名]
 def add(self, widget):
     ComplexPanel.add(self, widget)
     DOM.appendChild(self.getElement(), widget.getElement())
     return True
开发者ID:Afey,项目名称:pyjs,代码行数:6,代码来源:test008.py


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