Setting Application icon in my python Tk base application (On Ubuntu) -


i want set image in gui application built on python tk package.

i tried code:

root.iconbitmap('window.xbm') 

but gives me this:

root.iconbitmap('window.xbm')   file "/usr/lib/python2.7/lib-tk/tkinter.py", line 1567, in wm_iconbitmap     return self.tk.call('wm', 'iconbitmap', self._w, bitmap) _tkinter.tclerror: bitmap "window.xbm" not defined 

can help?

you want use wm iconphoto. being more used tcl/tk python tkinter don't know how exposed (maybe root.iconphoto) takes tkimage. in tcl/tk:

image create photo applicationicon -file application_icon.png wm iconphoto . -default applicationicon 

in tk 8.6 can provide png files. before have use tkimg extension png support or use gif. python pil package can convert images tkimage objects though should help.

edit

i tried out in python , following worked me:

import tkinter tkinter import tk root = tk() img = tkinter.image("photo", file="appicon.gif") root.tk.call('wm','iconphoto',root._w,img) 

doing interactively on ubuntu resulted in application icon (the image @ top left of frame , shown in taskbar) being changed use provided gif image.


Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -