本文整理汇总了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)
示例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)
示例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
示例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"
示例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)
示例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
示例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)
示例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