[Tkinter-discuss] icon for main window

Alexander Belchenko bialix at ukr.net
Mon Jan 15 08:20:13 CET 2007


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I wrote simple GUI program. But I have problem with setting icon for main window
of program. Icon works on Win32 well, but linux user report about error.

The code in question:

        # create root window
        self.root = Tk()
        self.root.title('Bazaar configuration')
        if os.path.isfile('./olive-branches.ico'):
            self.root.iconbitmap('./olive-branches.ico')

As I say above on windows this code works well. But on Linux it produce traceback:

> Traceback (most recent call last):
>  File "bzr-config.py", line 9, in ?
>    sys.exit(bzrconf.main())
>  File "/stuph/projects/bzr/bzr.repo/bzr-config/bzrconf/__init__.py", line
> 20, in main
>    app = Application([gm, am])
>  File
> "/stuph/projects/bzr/bzr.repo/bzr-config/bzrconf/gui/tkgui/__init__.py",
> line 22, in __init__
>    self.root.iconbitmap('olive-branches.ico')
>  File "/usr/lib/python2.4/lib-tk/Tkinter.py", line 1451, in wm_iconbitmap
>    return self.tk.call('wm', 'iconbitmap', self._w, bitmap)
> _tkinter.TclError: bitmap "olive-branches.ico" not defined


Does icons are windows-only feature, or I miss something important?
Full code as bzr branch here:
http://bazaar.launchpad.net/~bialix/bzr-config/trunk

Use command
$ bzr checkout --lightweight http://bazaar.launchpad.net/~bialix/bzr-config/trunk bzr-config

to get full sources.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFFqystzYr338mxwCURAiExAKCLa9wn/f0cAYC7IiuQE4poohnnhgCeLuOH
29fBLziyMuXD4fPaJK+OEIc=
=WqsE
-----END PGP SIGNATURE-----



More information about the Tkinter-discuss mailing list