尽管看到有关此主题的许多问题,但我找不到适合自己的难题的答案。我是Python的初学者,这是我的母语。我正在尝试创建一个对话框,该对话框在打开对话框时会自动运行。测试完成后,我希望打开另一个对话框,指出测试已完成。该测试可以正常运行。但是,由于辅助对话框正在调用的第二个实例Tk(),因此它将不会打开。
我的问题:如何更改我的代码,以便在测试完成后打开第二个对话框?
obj_rcs正在运行测试。 obj_config是第二个对话框。
我的代码:
enter code here
from configcomplete_slice import complete
from slice_setup import SLICE_SETUP
import Tkinter
import threading
import Queue
class GuiPart:
def __init__(self, master, queue):
self.queue = queue
master.geometry("300x100+400+250")
master.title("RSAM BCT")
Tkinter.Label(master, text= "REDCOM SLICE", fg="red").pack()
Tkinter.Label(master, text= "BCT - Basic Configuration Test",
fg= "red").pack()
Tkinter.Label(master, text= "Please wait...", fg= "black").pack()
Tkinter.Label(master, text= "Estimated time: 3 min 6 sec",
fg= "black").pack()
def processIncoming(self):
while self.queue.qsize():
try:
msg = self.queue.get(0)
print msg
except Queue.Empty:
pass
class ThreadedClient:
def __init__(self, master):
self.master = master
# Create the queue
self.queue = Queue.Queue()
# Set up the GUI part
self.gui = GuiPart(master, self.queue)
# Set up the thread to do asynchronous I/O
self.running = 1
self.thread1 = threading.Thread(target = self.workerThread1)
self.thread1.start()
self.periodicCall()
def periodicCall(self):
self.gui.processIncoming()
if not self.running:
import sys
sys.exit(1)
self.master.after(100, self.periodicCall)
def workerThread1(self):
while self.running:
obj_rcs = SLICE_SETUP()
obj_com = complete()
obj_rcs.SLICE()
obj_com.config()
root = Tkinter.Tk()
client = ThreadedClient(root)
root.mainloop()
相关分类