使您的程序使用gui [英] Make your program USE a gui

查看:107
本文介绍了使您的程序使用gui的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想编写一个能够通过控制鼠标/键盘并看到"屏幕上的内容来使用"其他程序的程序.

I'd like to write a program able to "use" other programs by taking control of the mouse/keyboard and being able to "see" what's on the screen.

我使用 AutoIt 来做类似的事情,但是我有时不得不作弊,因为这种语言是没有那么强大,或者仅仅是我很烂,我不能用它做太多事情:P

I used AutoIt to do something similar, but I had to cheat sometimes because the language is not that powerful, or maybe it's just that I suck and I'm not able to do that much with it :P

所以...我需要:

  • 获取屏幕截图,然后我将它们进行比较以使程序理解",但需要查看"
  • 使用鼠标:移动,单击并释放,很简单,不是吗?
  • 使用键盘:按某些键或组合键,包括特殊键,例如 Alt Ctrl 等...
  • Take screenshots, then I will compare them to make the program "understand", but it needs to "see"
  • Use the mouse: move, click and release, it's simple, isn't it?
  • Using the keyboard: pressing some keys, or key combinations, including special keys like Alt,Ctrl etc...

如何在python中做到这一点?
它可以在linux和Windows中使用吗? (这可能真的很酷,但这不是必需的)

How can I do that in python?
Does it works in both linux and windows? (this could be really really cool, but it is not necessary)

推荐答案

使用 PyWinAuto .

pywinauto是一组python模块 自动执行Microsoft Windows GUI. 最简单的是,它允许您发送 鼠标和键盘对Windows的操作 对话框和控件.

pywinauto is a set of python modules to automate the Microsoft Windows GUI. At it's simplest it allows you to send mouse and keyboard actions to windows dialogs and controls.

它还具有一些捕获对话框图像的支持,例如使用Python Imaging Library PIL .

It also has some support for capturing images of dialogs and such using the Python Imaging Library PIL.

这篇关于使您的程序使用gui的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆