从桂进口*在Python 3?(from Gui import * in python 3?)

2019-09-02 00:25发布

我想这样的:

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)

我收到一个错误,指出:从圭进口*导入错误:没有模块名为桂

我假设“从桂进口*”并不在Python 3工作,没有人知道如何在Python 3里这样做? 非常感谢 (:

Answer 1:

如果你正在谈论的是自带的沼泽GUI模块 ,然后才能使用Gui与Python3,你需要安装沼泽的Python3版本 。



文章来源: from Gui import * in python 3?