window icons in Tkinter

suyong suyong at fnal.gov
Fri Jul 26 16:57:10 EDT 2002


dsavitsk wrote:

> look for tkicon at http://effbot.org/downloads/
> 
> 
> "Steven" <sadams123 at optushome.com.au> wrote in message
> news:3d2e442c$0$11264$afc38c87 at news.optusnet.com.au...
> 
>>Can anyone shed some light on how to get the root window to use an icon
>>other than the 'Tk' symbol?
>>
>>I can't seem to find an example of this anywhere
>>
>>thanks
>>
>>Steven
>>
>>
>>
> 
> 

Standard way, I think, is something like the following code.
However, it only works for X bitmaps (you can create this using
programs like gimp), which means they're black
and white. Color bitmaps, according to some books,
should work, that's the part I commented out, because it
doesn't work. But then again, I'm not that experienced in python


#!/usr/bin/env python

from Tkinter import *

class RecoJobs(Frame):
     title = "D0Reco"
     def __init__(self):

         self.master.iconname('Reco jobs')
         self.master.iconbitmap('@reco.xbm')
         #self.label=Label(self, image=PhotoImage(file='reco.gif'))
         #self.master.iconwindow(self.label)


def test():
     """Simple test program."""
     RecoJobs().mainloop()

test()

the '@' in front of the file name reco.xbm, is important.

Suyong




More information about the Python-list mailing list