On Sat, 05 Mar 2016 19:36:19 +0100, Christian Gollwitzer wrote: > Am 05.03.16 um 19:10 schrieb Wildman: >> On Sat, 05 Mar 2016 10:47:09 -0600, Wildman wrote: >> >>> Anybody have the correct method of adding an icon to a >>> window? I have found several code examples on the web >>> but they all result in an error. Thanks. >> >> I found this and it works in Linux but only with black >> and white xbm images (I would prefer color): >> >> root.wm_iconbitmap('@myicon.xbm') > > iconphoto is the newer API for color icons. I am a bit surprised that it > is not wrapped in Tkinter, which is odd. You can still call it via eval: > > import Tkinter > from Tkinter import Tk > root = Tk() > img = Tkinter.Image("photo", file="appicon.gif") > root.call('wm','iconphoto',root._w,img)
The above worked perfectly. Thank you very much. > If you Tk is recent enough (8.6, you can find out by doing > root.eval('info patchlevel')), you can use .png files in addition to > .gif. If you need to read other image files, look into PIL and ImageTk. > > Christian According to "root.eval('info patchlevel')" I have version 8.6.2. PNG worked. That is good because PNG is a common file type for Linux icons. -- <Wildman> GNU/Linux user #557453 The cow died so I don't need your bull! -- https://mail.python.org/mailman/listinfo/python-list