title: Set Tkinter Python application icon in Mac OS X
body: <p>I have created a Tkinter GUI in Python. The following snippet shows how when the application starts it changes its icon to the one in icon.gif. This works on Ubuntu and Windows however it does not appear to do anything in Mac. If it helps I'm running Python 2.7.10 on OS X 10.9.5 with Tcl 8.5 &amp; Tk 8.5 (8.5.18). How can I change the icon that appears in the dock?</p>
  
  <pre><code>import Tkinter as TK
  
  class MyClass(object):
      def __init__(self, root):
          pass
  
  if __name__ == '__main__': 
          root = TK.Tk()
          my_app = MyApp(root)
          icon_path = 'some\long\path\to\icon.gif'
          img = TK.PhotoImage(file=icon_path)
          root.tk.call('wm', 'iconphoto', root._w, img)
          root.mainloop()
          root.destroy()
  </code></pre>