Sample code for MacADUK 2017: Introduction to PyObjC

If you will be attending my session at MacADUK 2017, you might find it useful to have copies of the sample Python code and scripts I’ll be talking about and demonstrating.

I’ve set up a GitHub repo. The sample code is basically complete, but I might make some minor changes over the next several days.

You can download the code samples here:

or if you are familiar with Git, you can clone them locally:
git clone

Hope to see you in London!

Sample code for MacADUK 2017: Introduction to PyObjC

Accessing More Frameworks with Python

This post is based on a column I wrote for MacTech magazine in 2012. MacTech used to make older columns available online, but they haven’t done that for the past several years for some reason.
I’m planning to go through my older columns and dust off and republish some that I think are still relevant or useful.

Recently, we built a command-line tool using Python and the PyObjC bridge to control display mirroring.
PyObjC supports a lot of OS X frameworks “out-of-the-box”, and accessing them from Python can be as simple as:

include CoreFoundation

But what if the problem you want to solve requires a framework that isn’t included with the PyObjC bindings? In turns out that you can create your own bindings. In this post we’ll explore this aspect of working with Python and OS X frameworks.


In my organization, we sometimes have a need to set displays to a certain ColorSync profile. The ColorSync profile to use for a given display is a per-user preference, so if you need to set it for all users of a machine, you can’t just manually set it while logged in as one user and call it good.

If you are managing display profiles for a group of machines, or a conference room machine that has network logins, you need a way to manage display profiles for all users. Using MCX or doing some defaults scripting might come to mind. Let’s look at that possibility.

Continue reading “Accessing More Frameworks with Python”

Accessing More Frameworks with Python