内容简介:http://stackoverflow.com/questions/11176638/tkinter-tclerror-error-reading-bitmap-file
我试图设置一个应用程序图标(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 上).我发现它 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
以上就是本文的全部内容,希望本文的内容对大家的学习或者工作能带来一定的帮助,也希望大家多多支持 码农网
猜你喜欢:- Redis应用-位图
- Redis应用-位图
- Lucene 位图实现 RoaringDocIdSet
- go 位图(bitmap)的实现
- android如何保存位图 – buggy代码
- Redis 精确去重计数 —— 咆哮位图
本站部分资源来源于网络,本站转载出于传递更多信息之目的,版权归原作者或者来源机构所有,如转载稿涉及版权问题,请联系我们。
Just My Type
Simon Garfield / Profile Books / 2010-10-21 / GBP 14.99
What's your type? Suddenly everyone's obsessed with fonts. Whether you're enraged by Ikea's Verdanagate, want to know what the Beach Boys have in common with easy Jet or why it's okay to like Comic Sa......一起来看看 《Just My Type》 这本书的介绍吧!