我正在尝试这个:
import os, sys
from Gui import *
import Image as PIL
import ImageTk
class ImageBrowser(Gui):
def __init__(self):
Gui.__init__(self)
self.button = self.bu(command=self.quit, relief=FLAT)
def image_loop(self, dirname='.'):
files = os.listdir(dirname)
for file in files:
try:
self.show_image(file)
print (file)
self.mainloop()
except IOError:
continue
except:
break
def show_image(self, filename):
image = PIL.open(filename)
self.tkpi = ImageTk.PhotoImage(image)
self.button.config(image=self.tkpi)
def main(script, dirname='.'):
g = ImageBrowser()
g.image_loop(dirname)
if __name__ == '__main__':
main(*sys.argv)
我收到一条错误消息:
从 Gui 导入 *
导入错误:没有名为 Gui 的模块
我假设“from Gui import *”在 python 3 中不起作用,有谁知道如何在 python 3 中执行此操作?太感谢了 (:
如果您正在谈论Swampy 自带的 Gui 模块 http://www.greenteapress.com/thinkpython/swampy/Gui.html, 然后
为了使用Gui
使用Python3,您需要安装Python3版本的Swampy http://www.greenteapress.com/thinkpython/swampy/install.html.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)