本文整理汇总了Python中pyjamas.DOM.createElement方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.createElement方法的具体用法?Python DOM.createElement怎么用?Python DOM.createElement使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.DOM
的用法示例。
在下文中一共展示了DOM.createElement方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: addRows
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def addRows(self, table, numRows, columns):
td = DOM.createElement("td")
DOM.setInnerHTML(td, " ")
row = DOM.createElement("tr")
for cellNum in range(columns):
cell = td.cloneNode(True)
row.appendChild(cell)
for rowNum in range(numRows):
table.appendChild(row.cloneNode(True))
示例2: testDivText
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def testDivText(self):
e = DOM.getElementById('tests')
div = DOM.createElement('div')
DOM.appendChild(e, div)
div2 = DOM.createElement('div')
DOM.appendChild(div, div2)
DOM.setInnerText(div2, 'hello world\n')
self.write_test_output('addDiv')
DOM.removeChild(e, div)
self.write_test_output('removeDiv')
示例3: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def __init__(self, caption, widget=None, **kwargs):
if kwargs.has_key('Element'):
element = kwargs.pop('Element')
else:
element = DOM.createElement("fieldset")
self.legend = DOM.createElement("legend")
DOM.appendChild(element, self.legend)
kwargs['Caption'] = caption
if widget is not None:
kwargs['Widget'] = widget
SimplePanel.__init__(self, element, **kwargs)
示例4: add_tinymce
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def add_tinymce(self):
# for storing the results when available
iframe = DOM.createElement("iframe")
DOM.setElemAttribute(iframe, "id", "__edit_%s" % self.editor_id)
DOM.setElemAttribute(iframe, "style", "display:none")
doc().body.appendChild(iframe)
# activate tinymce
new_script = DOM.createElement("script")
new_script.innerHTML = """
tinyMCE.init({
// General options
mode : "textareas",
theme : "simple",
// Theme options
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,|,table,removeformat",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true,
});
"""
ih = """
var ed = new tinymce.Editor('%s',{
mode : "none",
theme : "advanced",
plugins : "inlinepopups",
theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,formatselect,|,table,image,removeformat",
theme_advanced_buttons2 : "",
theme_advanced_buttons3 : "",
theme_advanced_buttons4 : "",
theme_advanced_toolbar_location : "top",
theme_advanced_toolbar_align : "left",
theme_advanced_statusbar_location : "bottom",
theme_advanced_resizing : true
});
ed.render();
ed.load();
tinymce.add(ed);
""" % self.editor_id
print new_script.innerHTML
DOM.setElemAttribute(new_script, "type", "text/javascript")
doc().body.appendChild(new_script)
示例5: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def __init__(self, apiKey):
self.__init__._super()
"""
* <p>
* required
* param event_app_id
* string This is the application ID from the application you
* just created above. You must specify either the application ID
* or the API key.
* param apikey
* string The API key from the application you just created
* above. You must specify either the application ID or the API
* key.
* optional
* param width
* int The width of the box in pixels. (Default value is 450
* pixels.)
* param height
* int The height of the box in pixels. (Default value is 400
* pixels.)
* param xid
* string If you want to have multiple Live Stream Boxes on your
* canvas pages, specify a unique XID for each box. Specify
* xid=EVENT_NAME, where EVENT_NAME represents the event.
* EVENT_NAME can include only numbers, letters, and underscores.
* (Default value is default.)
* </p>
"""
super(self.__class__,self).setElement(DOM.createElement(u"fb:live-stream"))
self.addStyleName(u"gwittit-FbLiveStream")
self.getElement().setAttribute(u"apikey", apiKey)
示例6: addMessage
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def addMessage(self, text):
d = datetime.now().strftime("%x %X")
li = DOM.createElement('li')
DOM.setInnerHTML(li,
'<dt class="time">%s</dt><dd class="txt">%s</dd>' % (
d, text))
DOM.insertChild(self.element, li, 0)
示例7: addDropWidget
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def addDropWidget(self):
s = len(self.children)
w = Label(Element=DOM.createElement('li'))
w.setID('effectdrop' + str(s))
w.setStyleName('drophere')
w.setText('Drop %s (%s)' % (s, self.data[s]))
self.append(w)
示例8: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def __init__(self, width=0, height=0):
Widget.__init__(self)
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"
self.focusable = None
self.focusable = Focus.createFocusable()
self.focusListeners = []
self.clickListeners = []
self.mouseListeners = []
self.keyboardListeners = []
DOM.appendChild(self.getElement(), self.focusable)
DOM.sinkEvents(canvas, Event.ONCLICK | Event.MOUSEEVENTS | DOM.getEventsSunk(canvas))
DOM.sinkEvents(self.focusable, Event.FOCUSEVENTS | Event.KEYEVENTS)
示例9: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def __init__(self):
AddablePanel.__init__(self, Element=DOM.createElement('div'))
DropWidget.__init__(self)
DragContainer.__init__(self)
self.setStyleName('drophere2')
self.setStyleAttribute('position', 'relative')
self.setSize('300px', '300px')
示例10: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def __init__(self, element=None):
Widget.__init__(self, Element=DOM.createElement('div'))
self.children = []
if element is not None:
clone = cloneElement(element)
self.addChild(clone)
self.setStyleAttribute('position', 'absolute')
示例11: onreadystatechange
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def onreadystatechange():
if xhtoj.readyState == 4:
jsnode = 0
if xhtoj.status == 200:
txt = xhtoj.responseText
jsnode = None
if idname:
jsnode = DOM.getElementById(idname)
if jsnode is None:
jsnode = DOM.createElement('script')
#tst = DOM.createElement('html')
#tst.innerHTML = str
activate_javascript(txt)
if not on_load_fn is None:
wnd().alert(on_load_fn)
# eval(on_load_fn)
test_fn()
return 1
else:
jsnode = DOM.getElementById(idname)
if not jsnode is None:
jsnode.innerHTML = xhtoj.status
示例12: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def __init__(self, text='', _doc=None):
self._e = DOM.createElement('style')
self._e.setAttribute('type', 'text/css')
setStyleElementText(self._e, text)
if _doc is None:
_doc = doc()
_doc.getElementsByTagName("head").item(0).appendChild(self._e)
示例13: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def __init__(self, fbml):
self.__init__._super()
"""
Fbml
@param fbml
"""
super(self.__class__,self).setElement(DOM.createElement(u"fb:serverFbml"))
DOM.setInnerHTML(self.getElement(), fbml)
示例14: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def __init__(self, cssFile=''):
self._e = DOM.createElement('link')
self._e.setAttribute('rel', 'stylesheet')
self._e.setAttribute('type', 'text/css')
self._e.setAttribute('href', cssFile);
print "css file", cssFile
doc().getElementsByTagName("head").item(0).appendChild(self._e)
示例15: addDragWidget
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createElement [as 别名]
def addDragWidget(self):
s = len(self.children)
w = Label(Element=DOM.createElement('li'))
w.setID('effectdrag' + str(s))
w.setStyleName('dragme')
w.setText('Drag %s (%s)' % (s, self.data[s]))
self.add(w)
makeDraggable(w)