python-3.x – tkinter TclError:讀取點陣圖檔案的錯誤
我試圖設定一個應用程式圖示(python3 / tkinter),如下所示:
Interface() root.title("Quicklist Editor") root.iconbitmap('@/home/jacob/.icons/qle_icon.ico') root.resizable(0, 0) root.mainloop()
不管我做什麼,我會收到一條錯誤訊息(Idle),說:
return self.tk.call('wm', 'iconbitmap', self._w, bitmap) _tkinter.TclError: error reading bitmap file "/home/jacob/.icons/qle_icon.ico"
我究竟做錯了什麼?
問題不在於程式碼,而是圖示.我嘗試用Gimp(一些KDE圖示編輯器)建立另一個程式的xbm,儘管它看起來很可怕,但卻顯示出一個圖示.
我想我必須找到一個建立者,為我的Python程式提供一個“可理解”的圖示.
編輯
iconbitmap方法只是黑色和白色,所以沒有用.
經過漫長的搜尋,我找到了解決方案來設定Python 3應用程式圖示的顏色(在Linux上).我發現它ofollow,noindex" target="_blank">here :
root = Tk() img = PhotoImage(file='your-icon') root.tk.call('wm', 'iconphoto', root._w, img)
http://stackoverflow.com/questions/11176638/tkinter-tclerror-error-reading-bitmap-file