[Tkinter] LONG POST ALERT: Setting application icon on Linux

Tim Jarman tmj at SPAMLESSjarmania.com
Sun Mar 27 12:01:41 EST 2005


Jeff Epler wrote:

> Here is a short program that sets Tk's window icon on Linux.  My window
> manager is icewm, and it uses a scaled version of the "flagup" image
> both at the upper-left corner of the window and on the task bar entry
> for the window.
> 
>     import Tkinter
>     app = Tkinter.Tk()
>     app.iconbitmap("@/usr/X11R6/include/X11/bitmaps/flagup")
>     app.mainloop()
> 
> As often happens, the Tkinter documentation doesn't tell the whole
> story---you have to dig into the Tk documentation.  I started with "man
> n wm", and read the following:
>     If  bitmap is specified, then it names a bitmap in the standard
>     forms accepted by Tk (see the  Tk_GetBitmap  manual  entry for
>     details).
> OK, on to Tk_GetBitmap...
>     @fileName     FileName  must  be the name of a file containing a
>                   bitmap description in the standard X11 or X10 format.
> and I happened to know that some bitmaps in this format exist in the
> directory I mentioned above.  Note that the "standard X11 format" is
> monochrome, so you will not be able to use color images with
> "iconbitmap" on Linux.  Tk doesn't support _NET_WM_ICON for setting
> full-color icons.
> 
> Jeff

Thanks for this, Jeff - I'll do some digging in the Tk docs. My problem is
that I'm trying to use iconwindow() to use a colour image, as opposed to
iconbitmap(), although if push comes to shove I suppose I could use that.

Thanks again for the quick response - on Easter weekend too!

Tim J

-- 
Website: www DOT jarmania FULLSTOP com



More information about the Python-list mailing list