必备条件:wxpython包,图标文件(例如sample.ico)
执行步骤:
1. 将图标转换为内嵌于python脚本形式,控制台命令img2py -n AppIcon -a sample.ico myico.py
2. 源代码举例
import myico
class HelloFrame(wx.Frame):
"""
A Frame that says Hello World
"""
def __init__(self, *args, **kw):
# ensure the parent's __init__ is called
super(HelloFrame, self).__init__(*args, **kw)
self.SetIcon(myico.AppIcon.GetIcon())