python 窗体句柄_Python pyautogui窗口句柄(Python pyautogui window handle)
Python pyautogui窗口句柄(Python pyautogui window handle)
使用pyautogui是否有办法获取窗口的句柄,以便我可以确保只在该窗口上执行单击? 换句话说,如果我的窗口没有聚焦,则不会发生单击。 此外,如果我的窗口没有聚焦,那么我将其置于焦点,然后执行操作。
是否有任何其他支持此类功能的Python模块?
Using pyautogui is there a way to get a handle to a window so that I can ensure that a click is performed on that window only? In other words, if my window isn't in focus, then the click does not occur. Additionally, if my window isn't in focus then I bring it into focus and then perform the actions.
The way to identify a window could be an ID, window title etc similar to this https://autohotkey.com/docs/commands/WinGet.htm
Is there any other Python module that supports this kind of functionality?
原文:https://stackoverflow.com/questions/43785927
2019-12-06 07:36
相关问答
也许你没有正确使用click功能。 查看函数定义: 单击(x =无,y =无,clicks = 1,interval = 0.0,button ='left',duration = 0.0,tween =,pause = None,_pause = True) 使用pyautogui.click(650, 200, 10)你说x = 650,y = 200,点击= 10。 我想你想说pyautogui.click(650, 200, interval=10) 。 The problem may h...
是否有任何其他支持此类功能的Python模块? https://pywinauto.github.io https://pywinauto.readthedocs.io/en/latest/#some-similar-tools-for-comparison Is there any other Python module that supports this kind of functionality? https://pywinauto.github.io https://pywinauto....
这可能是因为你正在从Python 2.x shell中尝试它。 请在python3 shell上试试这个命令并尝试导入相同的命令。 It might be because you're trying it from a python 2.x shell. Instead try this command on a python3 shell and try importing the same.
看起来你需要导入ImageGrab from PIL import ImageGrab
Looks like you need to import ImageGrab from PIL import ImageGrab
我不确定SO上的格式设置是否正确(您的评论显示为关键字),但看起来您的while True语句之外有if语句。 如果是这种情况,它将永远不会被执行(或检查)。 #! python3
import pyautogui
import time
pyautogui.screenshot('first.png')
check = pyautogui.locateCenterOnScreen('first.png')
print(check)
while True:
pyautogui.scree...
要安装PyAutoGUI,请从PyPI和依赖项安装pyautogui软件包。 在Windows上,这是: C:Python34pip.exe install pyautogui
To install PyAutoGUI, install the pyautogui package from PyPI and dependencies. On Windows, this is: C:Python34pip.exe install pyautogui
Pyautogui的源代码 def _sendMouseEvent(ev, x, y, dwData=0):
assert x != None and y != None, 'x and y cannot be set to None'
width, height = _size()
convertedX = 65536 * x // width + 1
convertedY = 65536 * y // height + 1
ctypes.windll.u...
你可以修补pyautogui内部。 测试'xvfb'后端。 import os
from pyvirtualdisplay import Display
import pyautogui
import Xlib.display
v_display = Display(visible=1, size=(1600,900))
v_display.start() # this changes the DISPLAY environment variable
# sadly, pyautogui do...
我得到这个错误,发现它仍然执行这个点击: try:
pyautogui.click()
except:
print "Error-carrying on anyway"
或者,如果您不希望它打印任何东西: try:
pyautogui.click()
except:
pass
I got this error and found that it still performs the click- try this: try:
pyautogui.clic...
如果您需要可移植且可靠的解决方案,则必须找到支持辅助功能技术的库,以便按文本访问GUI元素。 基本技术是: Win32 API,MS UI自动化(Windows) AT-SPI(Linux) Apple Accessibility API(MacOS) 有几个开源GUI自动化库支持其中一些技术(通常为1或2)。 Python解决方案: Windows上的pywinauto (Win32 API和MS UIA,请参阅入门指南 ) Linux上的pyatspi2 MacOS上的pyatom Stack...
相关文章
当前屏幕分辨率为1280*1024,IE7下使用 window.open('', '', 'left
...
1、下载redis的window版本 下载地址: https://github.com/Service
...
Python 编程语言具有很高的灵活性,它支持多种编程方法,包括过程化的、面向对象的和函数式的。但最重
...
python2和python3的区别,1.性能 Py3.0运行 pystone benchmark的速
...
python的官网:http://www.python.org/ 有两个版本,就像struts1和st
...
Python的文件类型 Python有三种文件类型,分别是源代码文件、字节码文件和优化代码文件
源代
...
好久没有写了,还不是近期刚过的期末考试和期中考试 最近因为一个微信公众平台大赛在学phthon 找了本
...
python 窗体句柄_Python pyautogui窗口句柄(Python pyautogui window handle)相关推荐
- python自动化库_Python操作自动化库PyAutoGUI的方法
Python操作自动化库PyAutoGUI的方法 发布时间:2020-07-23 17:24:46 来源:亿速云 阅读:73 作者:小猪 这篇文章主要讲解了Python操作自动化库PyAutoGUI的 ...
- python 窗体编程_python窗体编程
广告关闭 云服务器1核2G首年99年,还有多款热门云产品满足您的上云需求 python里的图形化界面(gui)模块主要有tkinter(python自带).pyqt.wxpython,我们这节主要讲解 ...
- python窗体开发_python开发窗体
广告关闭 腾讯云11.11云上盛惠 ,精选热门产品助力上云,云服务器首年88元起,买的越多返的越多,最高返5000元! 虽然使用标准库tkinter开发python gui程序很方便,也提供了强大的功 ...
- python操作句柄_python句柄部分操作
# 通过窗口类名.窗口标题获取控件句柄 hwnd = win32gui.FindWindow("ClassName", "TitleName") # 通过句柄设 ...
- python窗体设置italic_007萝卜头学python:Python GUI 之Tkinter
萝卜头社区 http://www.luobotou.net 同学问,python有没有图形窗口? 肯定是有的,今天我们来了解下tkinter:Tkinter =tk+inter(接口) Tkinter ...
- python的使用说明_Python教程:Python中__init__.py的使用用法说明
Python中的Module是比较重要的概念.常见的情况是,事先写好一个.py文 件,在另一个文件中需要import时,将事先写好的.py文件拷贝 到当前目录,或者是在sys.path中增加事先写好的 ...
- python 函数修饰_python修饰函数 python 函数有多个修饰符
define的意思,用来定义函数. 如: def 函数名(参数1, 参数2, --, 参数N): 执行语句 # 例:简单的函数使用# 定义函数def hello(): print 'hello pyt ...
- python窗体按钮_Python ---(二)Tkinter窗口组件:Button
The Tkinter Button Widget ##简介 Button(按钮)组件用于实现各种各样的按钮.Button 组件可以包含文本或图像,你可以将一个 Python 的函数或方法与之相关联, ...
- python爬虫代码模板_Python:学习Python爬虫的第一天
疑问: 跟着Python教学视频,爬百度首页,结果不同?(代码.结果往下看) 1: 发现本地的IE浏览器打开百度有报错,搜狗浏览器可以正常打开.而且,eclipse执行出来的结果跟在IE浏览器百度首页 ...
- python app服务器_Python应用02 Python服务器进化
作者:Vamei 出处:http://www.cnblogs.com/vamei 欢迎转载,也请保留这段声明.谢谢! **注意,在Python 3.x中,BaseHTTPServer, SimpleH ...
最新文章
- 使用.NET Core快速开发一个较正规的命令行应用程序
- 三种方法删除有序表中s和t直接的元素(包含s和t)
- LongAdder分段锁机制
- 行走在成为程序猿的道路上
- Spring Cloud Dalston.SR5 BUG一记
- java写 IP十进制转变_java实现ip地址与十进制数相互转换
- 安卓java桌面图标程序_android如何定制默认桌面上应用程序和shortcut图标 | 学步园...
- Linux命令 - watch
- 鸿蒙系统正式开源,余承东:鸿蒙系统正式开源,友商也可以使用!
- CodeTank iOS App Technical Support
- ubuntu 16.04安装mysql_Ubuntu 16.04 安装mysql 5.7.16
- php微信使用腾讯地图进行定位,微信定位+腾讯地图导航
- 一步步开发自己的博客 .NET版(3、注册登录功能)
- HP P1108打印机安装
- c语言取地址和间接引用
- matlab脚本栏中间有条线,word中间有一根线 word中间有一条线如何去掉
- Lucene DocValues索引文件详解
- 有关服装流水线成功的话题
- 跨模态神经搜索实践VCED CLIP简介
- 计算机语言 机器码,什么是机器码 机器码封了怎么解决-与非网
热门文章
- 第三十四期:游戏开发中常见的10种编程语言
- Centos7安装nxlog-2.9
- 变废为宝,教你自己组建 NAS 服务器,非常简单实用。组装、品牌 NAS 推荐
- anaconda3.6.5安装pyhive
- 勒索病毒“永恒之蓝”变种再来,该如何关闭445端口(收藏)
- Win7 Server 漏洞修复(CVE-2017-**、CVE-2018-**、CVE-2019-**、CVE-2012-**)
- 高程(DEM) ASCII数据获取
- c语言字符串转16进制及16进制转字符串
- C语言编程软件的下载安装、使用和写代码
- 自动化脚本任务计划程序(Windows)