• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python winUser.setCursorPos函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中winUser.setCursorPos函数的典型用法代码示例。如果您正苦于以下问题:Python setCursorPos函数的具体用法?Python setCursorPos怎么用?Python setCursorPos使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了setCursorPos函数的18个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: script_showSelectionOptions

	def script_showSelectionOptions(self, gesture):
		fakeSel = self.selection
		if fakeSel.isCollapsed:
			# Double click to access the toolbar; e.g. for annotations.
			try:
				p = fakeSel.pointAtStart
			except NotImplementedError:
				log.debugWarning("Couldn't get point to click")
				return
			log.debug("Double clicking")
			winUser.setCursorPos(p.x, p.y)
			winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0, None, None)
			winUser.mouse_event(winUser.MOUSEEVENTF_LEFTUP, 0, 0, None, None)
			winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0, None, None)
			winUser.mouse_event(winUser.MOUSEEVENTF_LEFTUP, 0, 0, None, None)
			return

		# The user makes a selection using browse mode virtual selection.
		# Update the selection in Kindle.
		# This will cause the options to appear.
		fakeSel.innerTextInfo.updateSelection()
		# The selection might have been adjusted to meet word boundaries,
		# so retrieve and report the selection from Kindle.
		# we can't just use self.makeTextInfo, as that will use our fake selection.
		realSel = self.rootNVDAObject.makeTextInfo(textInfos.POSITION_SELECTION)
		# Translators: Announces selected text. %s is replaced with the text.
		speech.speakSelectionMessage(_("selected %s"), realSel.text)
		# Remove our virtual selection and move the caret to the active end.
		fakeSel.innerTextInfo = realSel
		fakeSel.collapse(end=not self._lastSelectionMovedStart)
		self.selection = fakeSel
开发者ID:JRMeyer,项目名称:nvda,代码行数:31,代码来源:kindle.py


示例2: event_gainFocus

	def event_gainFocus(self):
		if mouseHandler.lastMouseEventTime < time.time() - 0.2:
			# This focus change was not caused by a mouse event.
			# If the mouse is on another toolbar control, the notification area toolbar will rudely
			# bounce the focus back to the object under the mouse after a brief pause.
			# Moving the mouse to the focus object isn't a good solution because
			# sometimes, the focus can't be moved away from the object under the mouse.
			# Therefore, move the mouse out of the way.
			winUser.setCursorPos(0, 0)

		if self.role == controlTypes.ROLE_TOOLBAR:
			# Sometimes, the toolbar itself receives the focus instead of the focused child.
			# However, the focused child still has the focused state.
			for child in self.children:
				if child.hasFocus:
					# Redirect the focus to the focused child.
					eventHandler.executeEvent("gainFocus", child)
					return
			# We've really landed on the toolbar itself.
			# This was probably caused by moving the mouse out of the way in a previous focus event.
			# This previous focus event is no longer useful, so cancel speech.
			speech.cancelSpeech()

		if eventHandler.isPendingEvents("gainFocus"):
			return
		super(NotificationArea, self).event_gainFocus()
开发者ID:BabbageCom,项目名称:nvda,代码行数:26,代码来源:explorer.py


示例3: mouseEvents

def mouseEvents(location, *events):
	x,y = int (location[0]+location[2]/2), int (location[1]+location[3]/2)
	#move the cursor
	winUser.setCursorPos (x,y)
	#simulation of pressing mouse button
	for event in events:
		winUser.mouse_event(event, 0, 0, None, None)
开发者ID:ragb,项目名称:nvda-ragb-plugins,代码行数:7,代码来源:__init__.py


示例4: _activateNVDAObject

	def _activateNVDAObject(self, obj):
		while obj and obj != self.rootNVDAObject:
			try:
				obj.doAction()
				break
			except:
				log.debugWarning("doAction failed")
			if controlTypes.STATE_OFFSCREEN in obj.states or controlTypes.STATE_INVISIBLE in obj.states:
				obj = obj.parent
				continue
			try:
				l, t, w, h = obj.location
			except TypeError:
				log.debugWarning("No location for object")
				obj = obj.parent
				continue
			if not w or not h:
				obj = obj.parent
				continue
			log.debugWarning("Clicking with mouse")
			x = l + w / 2
			y = t + h / 2
			oldX, oldY = winUser.getCursorPos()
			winUser.setCursorPos(x, y)
			mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN, 0, 0)
			mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP, 0, 0)
			winUser.setCursorPos(oldX, oldY)
			break
开发者ID:MarcoZehe,项目名称:nvda,代码行数:28,代码来源:gecko_ia2.py


示例5: showGui

	def showGui(self):
		# The menu pops up at the location of the mouse, which means it pops up at an unpredictable location.
		# Therefore, move the mouse to the centre of the screen so that the menu will always pop up there.
		left, top, width, height = api.getDesktopObject().location
		x = width / 2
		y = height / 2
		winUser.setCursorPos(x, y)
		self.sysTrayIcon.onActivate(None)
开发者ID:timothytylee,项目名称:nvda,代码行数:8,代码来源:__init__.py


示例6: moveMouseToNVDAObject

def moveMouseToNVDAObject(obj):
	"""Moves the mouse to the given NVDA object's position""" 
	location=obj.location
	if location and (len(location)==4):
		(left,top,width,height)=location
		x=(left+left+width)/2
		y=(top+top+height)/2
		winUser.setCursorPos(x,y)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:8,代码来源:api.py


示例7: _setCaretOffset

	def _setCaretOffset(self,offset):
		rects=self._textAndRects[1]
		if offset>=len(rects):
			raise RuntimeError("offset %d out of range")
		left,top,right,bottom=rects[offset]
		x=left #+(right-left)/2
		y=top+(bottom-top)/2
		oldX,oldY=winUser.getCursorPos()
		winUser.setCursorPos(x,y)
		winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN,0,0,None,None)
		winUser.mouse_event(winUser.MOUSEEVENTF_LEFTUP,0,0,None,None)
		winUser.setCursorPos(oldX,oldY)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:12,代码来源:displayModel.py


示例8: _setCaretOffset

	def _setCaretOffset(self,offset):
		rects=self._storyFieldsAndRects[1]
		if offset>=len(rects):
			raise RuntimeError("offset %d out of range")
		left,top,right,bottom=rects[offset]
		x=left #+(right-left)/2
		y=top+(bottom-top)/2
		x,y=windowUtils.logicalToPhysicalPoint(self.obj.windowHandle,x,y)
		oldX,oldY=winUser.getCursorPos()
		winUser.setCursorPos(x,y)
		winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN,0,0,None,None)
		winUser.mouse_event(winUser.MOUSEEVENTF_LEFTUP,0,0,None,None)
		winUser.setCursorPos(oldX,oldY)
开发者ID:Alain-Ambazac,项目名称:nvda,代码行数:13,代码来源:displayModel.py


示例9: doAction

	def doAction(self,index=None):
		if not index:
			l=self.location
			if l:
				x=l[0]
				y=l[1]
				oldX,oldY=winUser.getCursorPos()
				winUser.setCursorPos(x,y)
				mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN,0,0)
				time.sleep(0.2)
				mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP,0,0)
				winUser.setCursorPos(oldX,oldY)
				return
		raise NotImplementedError
开发者ID:BabbageCom,项目名称:nvda,代码行数:14,代码来源:mscandui.py


示例10: activate

	def activate(self):
		"""Activate this position.
		For example, this might activate the object at this position or click the point at this position.
		@raise NotImplementedError: If not supported.
		"""
		if not self.obj.isInForeground:
			raise NotImplementedError
		import winUser
		p=self.pointAtStart
		oldX,oldY=winUser.getCursorPos()
		winUser.setCursorPos(p.x,p.y)
		winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN,0,0,None,None)
		winUser.mouse_event(winUser.MOUSEEVENTF_LEFTUP,0,0,None,None)
		winUser.setCursorPos(oldX,oldY)
开发者ID:josephsl,项目名称:nvda4nvda,代码行数:14,代码来源:__init__.py


示例11: _activateNVDAObject

	def _activateNVDAObject(self, obj):
		try:
			obj.doAction()
		except:
			log.debugWarning("could not programmatically activate field, trying mouse")
			l=obj.location
			if l:
				x=(l[0]+l[2]/2)
				y=l[1]+(l[3]/2) 
				oldX,oldY=winUser.getCursorPos()
				winUser.setCursorPos(x,y)
				winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN,0,0,None,None)
				winUser.mouse_event(winUser.MOUSEEVENTF_LEFTUP,0,0,None,None)
				winUser.setCursorPos(oldX,oldY)
			else:
				log.debugWarning("no location for field")
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:16,代码来源:gecko_ia2.py


示例12: script_clickButtonCancel

	def script_clickButtonCancel (self,gesture):
		# Translators: the title of the dropbox preferences dialog, it is important to have the same capitalization/spelling as in the dropbox gui. If Dropbox hasn't been translated to your language yet, leave this blank or write the original text.
		if api.getFocusObject().windowText == u'DropboxTrayIcon' or api.getFocusObject().windowClassName == u'#32768' or api.getForegroundObject().name != _("Dropbox Preferences"):
			gesture.send()
			return
		cancelButton=api.getForegroundObject().simpleLastChild
		# Translators: the name of the dropbox preferences cancel button, it is important to have the same capitalization/spelling as in the dropbox gui. If Dropbox hasn't been translated to your language yet, leave this blank or write the original text.
		if cancelButton.name != _('Cancel'):
			cancelButton=cancelButton.simplePrevious if cancelButton.simplePrevious.name == _('Cancel') else None
		if cancelButton == None:
			ui.message(_("Cancel button not found"))
			gesture.send()
		else:
			(x,y,l,h) = cancelButton.IAccessibleObject.accLocation (0)
			winUser.setCursorPos (x,y)
			winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN,0,0,None,None)
			winUser.mouse_event (winUser.MOUSEEVENTF_LEFTUP,0,0,None,None)
开发者ID:pzajda,项目名称:dropbox,代码行数:17,代码来源:dropbox.py


示例13: rightMouseButton

def rightMouseButton(o):
	""" make a right click
	@param o the object to click on"""
	# We get the object idea because we cannot act to the object dirrectly
	IDChild =o.IAccessibleChildID
	# We have to get the parent, this is a particularity.
	o=o.parent
	# We get the shild object location which has IDChild as id
	(x,y,l,h)=o.IAccessibleObject.accLocation(IDChild)
	#We calculate the center of the shild object
	x,y=int (x+l/2),int (y+h/2)
	# We move the cursor
	winUser.setCursorPos (x,y)
	# We make the right click event
	winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTDOWN,0,0,None,None)
	# Then, the release button event
	winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTUP,0,0,None,None)
开发者ID:pzajda,项目名称:dropbox,代码行数:17,代码来源:SayStatedropbox.py


示例14: _activateNVDAObject

	def _activateNVDAObject(self, obj):
		try:
			obj.doAction()
		except:
			log.debugWarning("could not programmatically activate field, trying mouse")
			while obj and controlTypes.STATE_OFFSCREEN in obj.states and obj!=self.rootNVDAObject:
				obj=obj.parent
			l=obj.location
			if l:
				x=(l[0]+l[2]/2)
				y=l[1]+(l[3]/2) 
				oldX,oldY=winUser.getCursorPos()
				winUser.setCursorPos(x,y)
				winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN,0,0,None,None)
				winUser.mouse_event(winUser.MOUSEEVENTF_LEFTUP,0,0,None,None)
				winUser.setCursorPos(oldX,oldY)
			else:
				log.debugWarning("no location for field")
开发者ID:sonar-gnu-linux,项目名称:nvda,代码行数:18,代码来源:gecko_ia2.py


示例15: script_moveMouseToNavigatorObject

	def script_moveMouseToNavigatorObject(self,gesture):
		obj=api.getNavigatorObject() 
		try:
			p=api.getReviewPosition().pointAtStart
		except (NotImplementedError, LookupError):
			p=None
		if p:
			x=p.x
			y=p.y
		else:
			try:
				(left,top,width,height)=obj.location
			except:
				ui.message(_("object has no location"))
				return
			x=left+(width/2)
			y=top+(height/2)
		winUser.setCursorPos(x,y)
		mouseHandler.executeMouseMoveEvent(x,y)
开发者ID:atsuoishimoto,项目名称:tweetitloud,代码行数:19,代码来源:globalCommands.py


示例16: _activateNVDAObject

	def _activateNVDAObject(self, obj):
		try:
			obj.doAction()
			return
		except:
			pass

		log.debugWarning("could not programmatically activate field, trying mouse")
		l=obj.location
		if not l:
			log.debugWarning("no location for field")
			return
		x=(l[0]+l[2]/2)
		y=l[1]+(l[3]/2) 
		oldX,oldY=winUser.getCursorPos()
		winUser.setCursorPos(x,y)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTDOWN,0,0)
		mouseHandler.executeMouseEvent(winUser.MOUSEEVENTF_LEFTUP,0,0)
		winUser.setCursorPos(oldX,oldY)
开发者ID:MarcoZehe,项目名称:nvda,代码行数:19,代码来源:adobeFlash.py


示例17: changePageTab

def changePageTab (h,sens):
	""" Change the active tab
	@param h the handle of tab page
	@param sens : string, next or prior """
	#index =getPageTabActive ()[-1]
	index=listPageTab.index(getPageTabActive(h))
	if sens =="next":
		index+=1
	else:
		index-=1

	index %= len(listPageTab)

	(x, y, l, h) = NVDAObjects.IAccessible.getNVDAObjectFromEvent(h,-4,0).location
	x=x+(1,3,5,7,9)[index]*l/10
	y=y+h/2
	winUser.setCursorPos (x,y)
	winUser.mouse_event(winUser.MOUSEEVENTF_LEFTDOWN,0,0,None,None)
	winUser.mouse_event (winUser.MOUSEEVENTF_LEFTUP,0,0,None,None)

	#announces the new tab
	ui.message(listPageTab[index])
开发者ID:pzajda,项目名称:dropbox,代码行数:22,代码来源:dropbox.py


示例18: script_touch_rightClick

	def script_touch_rightClick(self, gesture):
		self.etsDebugOutput("etouch: attempting to perform right-click")
		obj=api.getNavigatorObject() 
		try:
			p=api.getReviewPosition().pointAtStart
		except (NotImplementedError, LookupError):
			p=None
		if p:
			x=p.x
			y=p.y
		else:
			try:
				(left,top,width,height)=obj.location
			except:
				# Translators: Reported when the object has no location for the mouse to move to it.
				ui.message(_("object has no location"))
				return
			x=left+(width/2)
			y=top+(height/2)
		self.etsDebugOutput("etouch: mouse point found at %s, %s"%(x, y))
		winUser.setCursorPos(x,y)
		winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTDOWN,0,0,None,None)
		winUser.mouse_event(winUser.MOUSEEVENTF_RIGHTUP,0,0,None,None)
开发者ID:josephsl,项目名称:enhancedTouchGestures,代码行数:23,代码来源:__init__.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python win_unicode_console.enable函数代码示例发布时间:2022-05-26
下一篇:
Python winUser.isWindow函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap