Guys I am trying to add an image to the window I created, but I get an error message when I run my code:
import wx
class my_window(wx.Frame):
app=wx.PySimpleApp()
def __init__(self, parent, id):
window = wx.Frame.__init__(self,parent,id,'Window', size=(600,400))
window.SetIcon(wx.Icon('porcupine.ico', wx.BITMAP_TYPE_ICO))
if __name__ == "__main__":
frame=my_window(parent=None,id=-1)
frame.Center()
frame.Show()
app.MainLoop()
The message I get:
Traceback (most recent call last):
File "wxpython2.py", line 20, in <module>
frame=my_window(parent=None,id=-1)
File "wxpython2.py", line 17, in __init__
window.SetIcon(wx.Icon('porcupine.ico', wx.BITMAP_TYPE_ICO))
AttributeError: 'NoneType' object has no attribute 'SetIcon'