0
我有三個不同的文件三類,通過GUI錯誤:_tkinter.TclError:不能援引「WM」的命令:應用程序已經被破壞
#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
如何重新調用應用程序。在此先感謝
是的,現在我得到了解決方案,我把我的代碼整理成一個文件,並調用mainloop()一次! – WEshruth