我在三个不同的文件上有三个类,通过 GUI 获取用户输入
#file1
class GetInfo1():
def getInfo1():
#my code
return info1
#file2
class GetInfo2():
def getInfo2():
#my code
return info2
#file3
class GetInfo3():
def getInfo3():
#my code
return info3
从不同的文件调用这些方法,Getinformation.py
该文件将是
from GetInfo1 import *
from GetInfo2 import *
from GetInfo3 import *
object1 = GetInfo1()
getInfor1 = object1.getInfo1()
print getInfor1
object2 = GetInfo2()
getInfor2 = object2.getInfo2()
print getInfor2
object3 = GetInfo3()
getInfor3 = object3.getInfo3()
print getInfor3
课程如下:
from Tkinter import *
root = Tk()
app = Frame(root)
entry = Entry(app)
entry.grid()
class GetInfo1():
def OnClick(self):
global input1
input1 = entry.get()
#print ("You have entered %s"%input1)
root.destroy()
return input1
def getInfo1(self):
'''Window'''
global input1
root.title("Input Permutation Range ")
root.geometry("300x200")
app.grid()
label = Label (app, text="Please Enter the propogation range ( 2 - 4)")
label.grid()
'''Button'''
Object2 = AskPermutationRange()
button = Button (app, text="Submit", command=Object2.OnClick)
button.grid()
root.focus_set()
root.mainloop()
return input1
获取getInfor1
,getInfor2
如指定但在运行第三个对象时出现错误
_tkinter.TclError: can't invoke "wm" command: application has been destroyed
如何再次调用应用程序。提前致谢