On 3 Jan, 2008, at 23:08, Kevin Walzer wrote:
I'm looking for a Python API that will return the path to an icon file which I can then read via PIL and display in my application. The available API's that I can find--NSWorkspace andIconServices--provide various hooks to obtaining and displaying an icon, but neither appears to support finding the source file for an icon. Forinstance, I can use something like this in Cocoa to get an icon: NSWorkspace * ws = [NSWorkspace sharedWorkspace]; NSString * path = [ws fullPathForApplication:@"Safari"]; NSImage * icon = [ws iconForFile: path];
You can do this through the bundle API (open the bundle for an application, look up the name of the icon from the Info.plist and then locate that icon.
Something like: path = ... bundle = NSBundle.bundleWithPath_(path) info = bundle.infoDictionary() iconName = info['CFBundleIconFile'] iconPath = bundle.pathForResource_ofType_(iconName, 'icns') Ronald
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig