图形用户界面发现
discogui的Python项目详细描述
discogui发现gui元素
- 链接:
- 功能:
- python模块
- 在Linux上工作
- 不依赖辅助功能技术
- 工具包无关
- 仅在非常简单的gui上进行基本测试
- 图形用户界面应显示在xvfb或xephyr上
- 已知问题:
- 不支持Python 3
- 慢
- 可能的应用:
- 自动图形用户界面测试
- 自动图形用户界面控制
基本用法
from discogui.buttons import discover_buttons from easyprocess import EasyProcess from pyvirtualdisplay import Display with Display(): with EasyProcess('zenity --question') as p: p.sleep(1) buttons = discover_buttons() print buttons
安装
一般
ubuntu 14.04
sudo apt-get install python-pip xvfb python-xlib scrot python-pil xdotool sudo pip install https://github.com/pepijndevos/PyMouse/zipball/master sudo pip install discogui
卸载
# as root pip uninstall discogui
用法
基本
代码:
#-- include('examples/basic.py')--# ''' 1. start zenity Yes/No dialog on Xvfb 2. discover buttons using :mod:`discogui.buttons` module 3. print rectangles ''' from discogui.buttons import discover_buttons from easyprocess import EasyProcess from pyvirtualdisplay import Display def main(): with Display(visible=0): with EasyProcess('zenity --question') as p: p.sleep(5) buttons = discover_buttons() print( buttons ) if __name__ == '__main__': main() #-#
输出:
#-- sh('python -m discogui.examples.basic 2>/dev/null')--# [ScreenRect((582,407,667,442)), ScreenRect((491,407,576,442))] #-#