Python Tkinter/GUI导入错误

Python Tkinter/GUI导入错误,python,user-interface,tkinter,Python,User Interface,Tkinter,我在PageGUI中创建了简单的计算器,然后复制代码并在Python3.6.3中运行,但它给了我这个错误 import sys try: from Tkinter import * except ImportError: from tkinter import * try: import ttk py3 = False except ImportError: import t

我在PageGUI中创建了简单的计算器,然后复制代码并在Python3.6.3中运行,但它给了我这个错误

    import sys
    try:
        from Tkinter import *
    except ImportError:
        from tkinter import *

    try:
        import ttk
        py3 = False
    except ImportError:
        import tkinter.ttk as ttk
        py3 = True

    import _support

    def vp_start_gui():
        '''Starting point when module is the main routine.'''
        global val, w, root
    root = Tk()
    top = Simple_Calculator (root)
    _support.init(root, top)
    root.mainloop()

    w = None 
    def create_Simple_Calculator(root, *args, **kwargs):
        '''Starting point when module is imported by another program.'''
        global w, w_win, rt
        rt = root
        w = Toplevel (root)
        top = Simple_Calculator (w)
        _support.init(w, top, *args, **kwargs)
        return (w, top)

   def destroy_Simple_Calculator():
       global w
       w.destroy()
       w = None


   class Simple_Calculator:
       def __init__(self, top=None):
           '''This class configures and populates the toplevel window.
           top is the toplevel containing window.'''
           _bgcolor = '#d9d9d9'  # X11 color: 'gray85'
           _fgcolor = '#000000'  # X11 color: 'black'
           _compcolor = '#d9d9d9' # X11 color: 'gray85'
           _ana1color = '#d9d9d9' # X11 color: 'gray85' 
           _ana2color = '#d9d9d9' # X11 color: 'gray85' 

           top.geometry("346x238+495+156")
           top.title("Simple Calculator")
           top.configure(background="#d9d9d9")



       self.but40 = Button(top)
       self.but40.place(relx=0.14, rely=0.38, height=24, width=67)
       self.but40.configure(activebackground="#d9d9d9")
       self.but40.configure(activeforeground="#000000")
       self.but40.configure(background="#7d83d8")
       self.but40.configure(disabledforeground="#a3a3a3")
       self.but40.configure(foreground="#000000")
       self.but40.configure(highlightbackground="#d9d9d9")
       self.but40.configure(highlightcolor="black")
       self.but40.configure(pady="0")
       self.but40.configure(text='''Add''')
       self.but40.configure(width=67)

       self.but41 = Button(top)
       self.but41.place(relx=0.38, rely=0.38, height=24, width=67)
       self.but41.configure(activebackground="#d9d9d9")
       self.but41.configure(activeforeground="#000000")
       self.but41.configure(background="#7d83d8")
       self.but41.configure(disabledforeground="#a3a3a3")
       self.but41.configure(foreground="#000000")
       self.but41.configure(highlightbackground="#d9d9d9")
       self.but41.configure(highlightcolor="black")
       self.but41.configure(pady="0")
       self.but41.configure(text='''Sub''')

       self.but42 = Button(top)
       self.but42.place(relx=0.14, rely=0.55, height=24, width=67)
       self.but42.configure(activebackground="#d9d9d9")
       self.but42.configure(activeforeground="#000000")
       self.but42.configure(background="#7d83d8")
       self.but42.configure(disabledforeground="#a3a3a3")
       self.but42.configure(foreground="#000000")
       self.but42.configure(highlightbackground="#d9d9d9")
       self.but42.configure(highlightcolor="black")
       self.but42.configure(pady="0")
       self.but42.configure(text='''Multiply''')

       self.but43 = Button(top)
       self.but43.place(relx=0.38, rely=0.55, height=24, width=67)
       self.but43.configure(activebackground="#d9d9d9")
       self.but43.configure(activeforeground="#000000")
       self.but43.configure(background="#7d83d8")
       self.but43.configure(disabledforeground="#a3a3a3")
       self.but43.configure(foreground="#000000")
       self.but43.configure(highlightbackground="#d9d9d9")
       self.but43.configure(highlightcolor="black")
       self.but43.configure(pady="0")
       self.but43.configure(text='''Divide''')
       self.but43.configure(width=67)

       self.Button2 = Button(top)
       self.Button2.place(relx=0.72, rely=0.71, height=24, width=49)
       self.Button2.configure(activebackground="#d9d9d9")
       self.Button2.configure(activeforeground="#000000")
       self.Button2.configure(background="#9a63d8")
       self.Button2.configure(disabledforeground="#a3a3a3")
       self.Button2.configure(foreground="#000000")
       self.Button2.configure(highlightbackground="#d9d9d9")
       self.Button2.configure(highlightcolor="black")
       self.Button2.configure(pady="0")
       self.Button2.configure(text='''Display''')
       self.Entry1 = Entry(top)
       self.Entry1.place(relx=0.12, rely=0.13,height=30, relwidth=0.47)
       self.Entry1.configure(background="#a6c1ff")
       self.Entry1.configure(disabledforeground="#a3a3a3")
       self.Entry1.configure(font="TkFixedFont")
       self.Entry1.configure(foreground="#000000")
       self.Entry1.configure(insertbackground="black")
       self.Entry1.configure(width=164)




       if __name__ == '__main__':
           vp_start_gui()
回溯(最近一次呼叫最后一次): 文件“C:/Users/Zeeshan Khalid/AppData/Local/Programs/Python/Python36-32/tkinter initial chec.py”,第22行,在 导入支持
ModuleNotFoundError:没有名为“\u support”的模块

您没有安装模块支持,缩进到处都是。

看起来您可能使用了页面(或其他GUI生成器)为GUI生成Python代码,是吗

当您使用生成器时,很难找到像这样的东西,它会创建包含您可能拥有或不拥有的库的代码

幸运的是,在这种情况下(如果您至少使用了PAGE),所讨论的库也是由PAGE生成的


您需要转到Gen_Python菜单,不仅选择“Generate Python GUI”项,还需要选择“Generate Support Module”项,以生成它正试图导入的库,其中包含“_Support”。

这段代码是一堆缩进错误,如果我试图修复这些错误,我会得到一个
语法错误。如果我们没有运行足够远的代码来实际解决问题,我就无法调试您的问题。同时,
\u support
方法应该来自哪里?Python 3.6的标准库中没有这样的东西。而且,考虑到它以下划线开头,它可能是某个库的私有部分,但我不知道是哪一个,也不知道您希望它出现的原因。如何安装模块支持正如@abarnert所说,您是从代码中调用它的,但它不是标准模块,所以我不知道您希望它来自哪里,但它在你代码的第14行。我看到您在稍后的代码中也尝试使用它的方法,那么您希望它来自哪里呢?