Cassowary: respect your constraints!
Some time ago, I read a good paper about using a linear constraint solver to efficiently determine positioning and sizing of widgets in graphical user interfaces. For me, it was a novel concept and a good use of advanced mathematics I didn’t think of.
Yesterday a friend of mine showed me a cool Python GUI library that, incidentally, uses this concept (and the algorithm described in a companion paper). The pure Python library they used is called Cassowary (the same of the algorithm’s name), and it’s really simple to use. You can find more details on installation and usage on the github repository.
(Hey, Apple uses it too!)