How control a GUI for an unrelated application from a Python script?

Michael Torrie torriem at gmail.com
Thu Jun 13 21:34:54 EDT 2019


On 06/13/2019 05:49 PM, Christian Seberino wrote:
> I have a third party GUI that manages some hardware.
> 
> I want to control the hardware from a Python script.
> 
> This seems to mean I need to somehow have Python code
>   that imitates a human doing the necessary
>     actions on the GUI (selecting menu options, pressing buttons, etc.)
> 
> Is this possible

Maybe.

> / easy 
No.

> doable?

Maybe.

It's kind of the old "if you have to ask" sort of question.

There are ways of programatically driving other applications' user
interfaces.  You haven't said what OS you are using.  We used to use an
application called AutoIt to drive GUI programs.  You can send clicks,
keystrokes, and work with certain controls (read values, set values,
etc), at least if they are standard win32 widgets.  More and more
applications draw their own controls these days rather than use win32
widgets, which wouldn't be usable for that kind of modification.

As far as modifying a running GUI to add functionality, the answer to
that is probably "very difficult" to "impossible."  If the GUI itself is
just a frontend for command-line tools or even libraries that interact
with the hardware, then you probably could develop your own GUI from
scratch.

This is one reason why free and open source software wins. It's just
that much more flexible to manipulate and make to do cool new things.



More information about the Python-list mailing list