導(dǎo)入
from wx.lib.pubsub import pub
主進(jìn)程注冊(cè)標(biāo)識(shí)
pub.subscribe(self.append_output_text, ‘check’)
編寫檢測到check消息之后做的操作
def append_output_text(self,msg):
? ? ? ? self.output_textctrl.AppendText('? ? ')
? ? ? ? self.output_textctrl.AppendText(msg)
子線程發(fā)送消息
wx.CallAfter(pub.sendMessage, ‘check’, msg=i)
msg可以不用設(shè)置纵刘,但是wx.CallAfter內(nèi)參數(shù)必須跟定義的函數(shù)必須一致,不然就會(huì)報(bào)錯(cuò)
注銷當(dāng)前頁的所有消息標(biāo)識(shí)
pub.unsubAll()