1
當前正在開發一個項目,該項目需要多線程與物理設備進行交互,同時打開活動框以發送指令。Python多重處理與框架
的問題是,當框架催生和「你好」按鈕被按下時,test
方法運行,並且Process
運行LEDBehavior.BlinkYellowLightEverySecond()
正確是跑,但按鈕依然在它壓的圖形狀態,窗口變成反應遲鈍。
以下是此幀的代碼。
import LEDBehavior
class MainFrame (Frame):
def __init__(self, master=None):
Frame.__init__(self, master)
self.pack()
self.createWidgets()
def createWidgets(self):
self.hi_there = Button(self)
self.hi_there["text"] = "Hello",
self.hi_there["command"] = self.test
self.hi_there.pack({"side": "left"})
def test (self):
p1 = Process (LEDBehavior.BlinkYellowLightEverySecond())
p1.start()
p1.join()
# create the application
myapp = MainFrame()
#
# here are method calls to the window manager class
#
myapp.master.title ("Sample Text inc, Security Software Professionals")
myapp.master.maxsize (1920, 1080)
myapp.master.minsize (800, 640)
# start the program
myapp.mainloop()
我已經刪除了行'p1.join()',但問題仍然存在,並且幀保持無響應狀態。 – Vanitas
你可以發佈眨眼的代碼...? – kabanus
http://pastebin.com/GePfrgzv – Vanitas