本文整理汇总了Python中pyjamas.DOM.setEventListener方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.setEventListener方法的具体用法?Python DOM.setEventListener怎么用?Python DOM.setEventListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.DOM
的用法示例。
在下文中一共展示了DOM.setEventListener方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: onDetach
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setEventListener [as 别名]
def onDetach(self):
"""Called when this widget is being removed from the DOM tree of the document."""
if not self.isAttached():
return
self.doDetachChildren()
self.attached = False
DOM.setEventListener(self.getElement(), None)
示例2: onAttach
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setEventListener [as 别名]
def onAttach(self):
"""Called when this widget has an element, and that element is on the document's
DOM tree, and we have a parent widget."""
if self.isAttached():
return
self.attached = True
DOM.setEventListener(self.getElement(), self)
self.doAttachChildren()
self.onLoad()
示例3: prepareImage
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setEventListener [as 别名]
def prepareImage(self, url):
img = Image()
img.__isLoaded = False
img.addLoadListener(self)
# normally, event listeners are only set up when the widget
# is attached to part of the DOM (see Widget.onAttach). but,
# in this case, we want a load even _even though_ the Image
# widget is not yet attached (and quite likely won't be).
DOM.setEventListener(img.getElement(), img)
return img
示例4: __init__
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setEventListener [as 别名]
def __init__(self):
self._dragging = False
Canvas.__init__(self, Width=WIDTH, Height=HEIGHT)
canvasElement = self.getElement()
#Register for canvas mouse events
self._proc = Processing(DOM.getFirstChild(canvasElement))
self._proc.setup = (lambda: self.setup_proc())
self._proc.draw = None
self._proc.init()
DOM.sinkEvents(canvasElement, Event.MOUSEEVENTS)
DOM.setEventListener(canvasElement, self)
self._currentPointList = []
self._x = None
self._y = None
self._callback_Redraw = None
self._callback_AddStroke = None
self._callback_DeleteStroke = None
示例5: doDetachChildren
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setEventListener [as 别名]
def doDetachChildren(self):
for child in self:
child.onDetach()
DOM.setEventListener(self.focusable, None);
示例6: doAttachChildren
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setEventListener [as 别名]
def doAttachChildren(self):
for child in self:
child.onAttach()
DOM.setEventListener(self.focusable, self);
示例7: onAttach
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import setEventListener [as 别名]
def onAttach(self):
#print "Composite.onAttach", self
self.widget.onAttach()
DOM.setEventListener(self.getElement(), self);
self.onLoad()