Trying to write a python application that downloads images from an RSS feed, and makes a composite background. How do I get the current desktop resolution on Mac OS X (leopard?)
If you are doing this from a LaunchAgent script, you may need to drop down to CoreGraphics primitives rather than AppKit-level methods. Working on this today, my LaunchAgent-loaded script gets None
back from NSScreen.mainScreen()
, but works fine if I load it from a terminal in my session.
from Quartz import CGDisplayBounds
from Quartz import CGMainDisplayID
def screen_size():
mainMonitor = CGDisplayBounds(CGMainDisplayID())
return (mainMonitor.size.width, mainMonitor.size.height)