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


Python DOM.createImg方法代码示例

本文整理汇总了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()
开发者ID:FreakTheMighty,项目名称:pyjamas,代码行数:27,代码来源:DisclosurePanel.py

示例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)
开发者ID:anandology,项目名称:pyjamas,代码行数:27,代码来源:DNDTest.py

示例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 = []
开发者ID:Afey,项目名称:pyjs,代码行数:12,代码来源:Image.py

示例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)
开发者ID:anandology,项目名称:pyjamas,代码行数:21,代码来源:DisclosurePanel.py

示例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)
开发者ID:Afey,项目名称:pyjs,代码行数:21,代码来源:DisclosurePanel.py

示例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)
开发者ID:anthonyrisinger,项目名称:translate-pyjs-org.appspot.com,代码行数:74,代码来源:TreeItem.py

示例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
开发者ID:Afey,项目名称:pyjs,代码行数:6,代码来源:Image.py

示例8: createImage

# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import createImg [as 别名]
 def createImage(self):
     return DOM.createImg()
开发者ID:audreyr,项目名称:pyjs,代码行数:4,代码来源:TreeItem.py


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