Controlling the Mac OSX GUI via Python?

Chris Angelico rosuav at gmail.com
Thu Jun 30 18:35:27 EDT 2016


On Fri, Jul 1, 2016 at 8:27 AM, Lawrence D’Oliveiro
<lawrencedo99 at gmail.com> wrote:
> On Friday, July 1, 2016 at 7:22:43 AM UTC+12, Maitland Montmorency wrote:
>> I'd like to use Python to do some simple OSX GUI manipulations such as
>> automatically arranging windows, periodically refreshing applications
>> across multiple desktops, etc..
>>
>> I have tried to learn Applescript and Automator but they aren't really
>> scratching my itch.
>
> GUIs, by their nature, are not designed to be automated.

Doesn't mean they can't be! Ultimately, GUIs are just code, same as
everything else is, and code can be automated. On my Linux box (Debian
with Xfce), I've automated several aspects of the GUI, including
making certain windows "sticky" (ie visible regardless of which
workspace I'm on), and displaying crucial information in appropriate
places.

That said, though, there aren't always Python bindings for these sorts
of facilities. I end up calling on subprocesses most of the time,
because that's the easiest way to do things.

ChrisA



More information about the Python-list mailing list