set window icon tkinter macosx set window icon tkinter macosx tkinter tkinter

set window icon tkinter macosx


After 5 days of searching, and this post having been viewed at least 15 times I went directly to the tk/tcl documentation. If I understand this correctly, apparently there is no way to properly set the icon for mac OS X without using special library or other sort of hacks. It would be nice if there were a mac specific documentation for the tkinter library but alas there isn't that I have found. here is the part of the documentation I found:

wm iconphoto window ?-default? image1 ?image2 ...? Sets the titlebar icon for window based on the named photo images. If -default is specified, this is applied to all future created toplevels as well. The data in the images is taken as a snapshot at the time of invocation. If the images are later changed, this is not reflected to the titlebar icons. Multiple images are accepted to allow different images sizes (e.g., 16x16 and 32x32) to be provided. The window manager may scale provided icons to an appropriate size. On Windows, the images are packed into a Windows icon structure. This will override an ico specified to wm iconbitmap, and vice versa.

On X, the images are arranged into the _NET_WM_ICON X property, which most modern window managers support. A wm iconbitmap may exist simultaneously. It is recommended to use not more than 2 icons, placing the larger icon first.

On Macintosh, this currently does nothing.

if anyone has a working solution please post this. I want to accomplish this so that any system can open a freshly installed python and run my application without installing any additional library.


@GarryHurst This is not a solution but I sort of get the idea now:

  1. On Mac, TK decided that the icon will never appear on the window title bar.
  2. Instead, it shows up as the app's Dock icon.

It's most probably a by-design or won't fix issue on their side.