本文整理汇总了Python中pyjamas.DOM.createImg方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.createImg方法的具体用法?Python DOM.createImg怎么用?Python DOM.createImg使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.DOM
的用法示例。
在下文中一共展示了DOM.createImg方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createImg [as 别名]
def __init__(self, text, disclosurePanel):
Widget.__init__(self)
self.disclosurePanel = disclosurePanel
self.imageBase = pygwt.getModuleBaseURL()
self.root = DOM.createTable()
self.tbody = DOM.createTBody()
self.tr = DOM.createTR()
self.imageTD = DOM.createTD()
self.labelTD = DOM.createTD()
self.imgElem = DOM.createImg()
self.updateState()
self.setElement(self.root)
DOM.appendChild(self.root, self.tbody)
DOM.appendChild(self.tbody, self.tr)
DOM.appendChild(self.tr, self.imageTD)
DOM.appendChild(self.tr, self.labelTD)
DOM.appendChild(self.imageTD, self.imgElem)
self.setText(text)
disclosurePanel.addEventHandler(self)
self.updateState()
示例2: onDragStart
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createImg [as 别名]
def onDragStart(self, event):
dt = event.dataTransfer
target = DOM.eventGetTarget(event)
target = Widget(Element=target)
id = target.getID()
dt.setData("Text", "Dropped %s" % target.getID())
dt.effectAllowed = 'copy'
if id == 'imgdrag1':
parent = self.getParent()
while not hasattr(parent, 'h2'):
parent = parent.getParent()
dt.setDragImage(parent.h2.getElement(), 10, 10)
elif id == 'imgdrag2':
dt.setDragImage(doc().getElementById('logo'), 10, 10)
elif id == 'imgdrag3':
# OK, it's a bit of a cheat, but the following works on current
# Opera, IE, Firefox, Safari, Chrome.
ctx = GWTCanvas(50, 50)
self.makeCanvasImg(ctx)
try:
img = DOM.createImg()
DOM.setAttribute(img, 'src', ctx.canvas.toDataURL())
dt.setDragImage(img, 25, 25)
except:
dt.setDragImage(ctx.canvas, 25, 25)
示例3: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createImg [as 别名]
def __init__(self, url="", **kwargs):
if not kwargs.has_key('StyleName'): kwargs['StyleName']="gwt-Image"
if url: kwargs['Url'] = url
self.setElement(kwargs.pop('Element', None) or DOM.createImg())
Widget.__init__(self, **kwargs)
MouseHandler.__init__(self)
ClickHandler.__init__(self)
self.sinkEvents(Event.ONLOAD | Event.ONERROR)
self.loadListeners = []
示例4: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createImg [as 别名]
def __init__(self, text):
Widget.__init__(self)
self.imageBase = pygwt.getModuleBaseURL()
self.root = DOM.createTable()
self.tbody = DOM.createTBody()
self.tr = DOM.createTR()
self.imageTD = DOM.createTD()
self.labelTD = DOM.createTD()
self.imgElem = DOM.createImg()
self.setElement(self.root)
DOM.appendChild(self.root, self.tbody)
DOM.appendChild(self.tbody, self.tr)
DOM.appendChild(self.tr, self.imageTD)
DOM.appendChild(self.tr, self.labelTD)
DOM.appendChild(self.imageTD, self.imgElem)
self.setText(text)
示例5: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createImg [as 别名]
def __init__(self, text, images=True):
Widget.__init__(self)
self.setImageBase(images)
self.root = DOM.createTable()
self.tbody = DOM.createTBody()
self.tr = DOM.createTR()
self.imageTD = DOM.createTD()
self.labelTD = DOM.createTD()
self.imgElem = DOM.createImg()
self.setElement(self.root)
DOM.appendChild(self.root, self.tbody)
DOM.appendChild(self.tbody, self.tr)
DOM.appendChild(self.tr, self.imageTD)
DOM.appendChild(self.tr, self.labelTD)
DOM.appendChild(self.imageTD, self.imgElem)
self.setText(text)
示例6: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createImg [as 别名]
def __init__(self, html=None, **ka):
self.children = []
self.attached = False
self.contentPanel = None
self.itemTable = None
self.contentElem = None
self.imgElem = None
self.childSpanElem = None
self.open = False
self.parent = None
self.selected = False
self.tree = None
self.userObject = None
element = ka.pop('Element', None) or DOM.createDiv()
self.setElement(element)
self.itemTable = DOM.createTable()
self.contentElem = DOM.createSpan()
self.childSpanElem = DOM.createSpan()
self.imgElem = DOM.createImg()
tbody = DOM.createTBody()
tr = DOM.createTR()
tdImg = DOM.createTD()
tdContent = DOM.createTD()
DOM.appendChild(self.itemTable, tbody)
DOM.appendChild(tbody, tr)
DOM.appendChild(tr, tdImg)
DOM.appendChild(tr, tdContent)
DOM.setStyleAttribute(tdImg, "verticalAlign", "middle")
DOM.setStyleAttribute(tdContent, "verticalAlign", "middle")
DOM.setStyleAttribute(self.getElement(), "cursor", "pointer")
DOM.appendChild(self.getElement(), self.itemTable)
DOM.appendChild(self.getElement(), self.childSpanElem)
DOM.appendChild(tdImg, self.imgElem)
DOM.appendChild(tdContent, self.contentElem)
# XXX - can't set pos relative on a div node,
# or white_space on an HTML Table..
try:
DOM.setAttribute(self.getElement(), "position", "relative")
except:
pass
DOM.setStyleAttribute(self.contentElem, "display", "inline")
DOM.setStyleAttribute(self.getElement(), "whiteSpace", "nowrap")
try:
DOM.setAttribute(self.itemTable, "whiteSpace", "nowrap")
except:
pass
DOM.setStyleAttribute(self.childSpanElem, "whiteSpace", "nowrap")
self.setStyleName(self.contentElem, "gwt-TreeItem", True)
#if not ka.has_key('StyleName'): ka['StyleName']="gwt-TreeItem"
if html is not None:
try:
# messy. pyjd can do unicode, pyjs can't
if isinstance(html, unicode):
ka['HTML'] = html
elif isinstance(html, basestring):
ka['HTML'] = html
else:
ka['Widget'] = html
except:
if isinstance(html, basestring):
ka['HTML'] = html
else:
ka['Widget'] = html
UIObject.__init__(self, **ka)
示例7: prefetch
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createImg [as 别名]
def prefetch(self, url):
img = DOM.createImg()
DOM.setElemAttribute(img, "src", url)
prefetchImages[url] = img
示例8: createImage
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createImg [as 别名]
def createImage(self):
return DOM.createImg()