1
我创建了3个脚本,现在我在Tkinter中创建了一个简单的前端菜单。当我单独使用这些脚本时,他们会按照他们的要求工作并退出,所以我知道他们没有问题。问题必须与我的菜单(下)。Python:脚本在使用Tkinter时不会退出
从菜单中选择一个工具,调用另一个脚本并运行它。剧本只是挂起,等待,直到我敲击键盘上的输入。当我输入时,脚本就会退出。我怎样才能让它自动退出,而不是我必须进入?
在此先感谢。
from Tkinter import *
import Tkinter
import subprocess
root = Tkinter.Tk()
root.title("SimonsSoftware, 2014")
root.geometry('255x200+200+200')
text = Text(root)
text.insert(INSERT, "Please select which tool\nyou wish to use...")
def close_window():
root.withdraw()
def kill_window():
root.destroy()
def callDuff():
print "Call back works"
subprocess.Popen("python duff.duplicateFileFinder\duff.py", shell=True)
kill_window()
def callFibs():
print "Call back works"
subprocess.Popen("python fibs.FileInvestigationBiteSize\\fibs.py", shell=True)
close_window()
def callShift():
print "Call back works"
subprocess.Popen("python shift.SimonsHashInfoFinderTool\shift.py", shell=True)
close_window()
buttonOne = Tkinter.Button(root, text ="DUFF", relief=FLAT, command=callDuff)
buttonTwo = Tkinter.Button(root, text ="FIBS", relief=FLAT, command=callFibs)
buttonThree = Tkinter.Button(root, text ="SHIFT", relief=FLAT, command=callShift)
buttonOne.pack()
buttonTwo.pack()
buttonThree.pack()
text.pack()
root.mainloop()
root.withdraw()只是我玩弄的东西,我不打算将它用于此脚本。谢谢,我会给你一个机会。 – BubbleMonster