本文整理汇总了Python中pyjamas.DOM.eventGetAltKey方法的典型用法代码示例。如果您正苦于以下问题:Python DOM.eventGetAltKey方法的具体用法?Python DOM.eventGetAltKey怎么用?Python DOM.eventGetAltKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyjamas.DOM
的用法示例。
在下文中一共展示了DOM.eventGetAltKey方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getKeyboardModifiers
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetAltKey [as 别名]
def getKeyboardModifiers(event):
shift = 0
ctrl = 0
alt = 0
if DOM.eventGetShiftKey(event):
shift = MODIFIER_SHIFT
if DOM.eventGetCtrlKey(event):
ctrl = MODIFIER_CTRL
if DOM.eventGetAltKey(event):
alt = MODIFIER_ALT
return shift | ctrl | alt
示例2: onMouseDown
# 需要导入模块: from pyjamas import DOM [as 别名]
# 或者: from pyjamas.DOM import eventGetAltKey [as 别名]
def onMouseDown(self, sender, x, y):
"""
* Most browsers, by default, support the ability to
* to "drag-copy" any web page image to the desktop.
* But GChart's rendering makes extensive use of
* images, so we need to override this default.
*
"""
event = DOM.eventGetCurrentEvent()
DOM.eventPreventDefault(event)
self.ctrlPressed = DOM.eventGetCtrlKey(event)
self.altPressed = DOM.eventGetAltKey(event)
x = self.getXAxis().getMouseCoordinate()
y = self.getYAxis().getMouseCoordinate()
if (min(self.p1.x, self.p2.x) <= x and
x <= max(self.p1.x, self.p2.x) and
min(self.p1.y, self.p2.y) <= y and
y <= max(self.p1.y, self.p2.y)):
return; # ignore mouse down inside selection rectangle
self.p1.x = self.p2.x = x
self.p1.y = self.p2.y = y
xMin = self.getXAxis().getAxisMin()
xMax = self.getXAxis().getAxisMax()
yMin = self.getYAxis().getAxisMin()
yMax = self.getYAxis().getAxisMax()
self.initialPlotRegion.xMin = xMin
self.initialPlotRegion.xMax = xMax
self.initialPlotRegion.yMin = yMin
self.initialPlotRegion.yMax = yMax
if self.ctrlPressed:
self.selecting = True
self.moving = False
else:
self.selecting = False
self.moving = True
self.updateCursor()