养生 装修 购物 美食 感冒 便秘 营销 加盟 小吃 火锅 管理 创业 搭配 减肥 培训 旅游

importError: No module named images 解决方案

时间:2024-09-29 03:21:49

我们在学习wxpython的时候会出现这种错误,这种造成的原因是因为importimages库文件没导入进来。那么如何导入images库文件?

工具/原料

wxpython环境

方法/步骤

1、1.咯悝滩镞命名images.py文件输入以下代码:fromwximportImageFromStream,BitmapFromImagefromwximp泠贾高框ortEmptyIconimportcStringIOdefgetNewData():return\'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x0f\x08\x06\\x00\x00\x00\xedsO/\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\x00\\x00YIDATx\x9c\xed\xd31\n@!\x0c\x03\xd0\xa4\xfe\xfb\xdfX\xe3\xf0\x97R\xa5(.\\x0ef\x13\xe45\xa2\x92Vp\x92\xcf/\xd4\xaa\xb2\xcd\xb4\xc2\x14\x00\x00in\x90\\x84ZUDl\xa9\xa7\xc3c\xcb-\x80\xfc\x87{d8B6=B\xdb\rfy\xc0\r\xc0\xf0\x0e\xfc\\x1d\xaf\x84\xa7\xbf\xb1\x03\xe1,\x19&\x93\x9a\xd2\x97\x00\x00\x00\x00IEND\\xaeB`\x82'defgetNewBitmap():returnBitmapFromImage(getNewImage())defgetNewImage():stream=cStringIO.StringIO(getNewData())returnImageFromStream(stream)

2、2.在文件中导入images库文件importimages

3、这样就不会出现importError:Nomodulenamedimages的错误了。

© 一点知识