我用python写了一个程序,可以从网上下载图片。对于每张下载的图片,它都会在 GUI 中预览该图片,但每次这样做时,我都会收到以下错误:
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 14665, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
TypeError: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 14665, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
TypeError: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 14665, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
TypeError: 'NoneType' object is not callable
Traceback (most recent call last):
File "/usr/lib/python2.7/site-packages/wx-2.8-gtk2-unicode/wx/_core.py", line 14665, in <lambda>
lambda event: event.callable(*event.args, **event.kw) )
TypeError: 'NoneType' object is not callable
有趣的是:它仍然有效。但是这个错误是什么意思?我该如何解决?
导致此错误的代码应该是这一行:
wx.CallAfter(self.image.SetBitmap, wx.BitmapFromImage(wx.Image(imagePath, wx.BITMAP_TYPE_ANY).Rescale(width, height)))