I am creating a GUI and I am using the MVC pattern for creating it. As doing so, I am using pubsub to manage the events between the backend and the front end.
How can I make pubsub go across files?
My files are behind the link right here. (They are rather long files, my post would be huge otherwise.)
For instance:
On line 31 of gui_btn_panel.py, the program subscribes to the ENABLE NEXT
mailbox (pub.subscribe(self.next_step,"ENABLE NEXT")
).
Then, on line 232开发者_如何学JAVA of gui_step_1.py, the program publishes a message with the tag ENABLE NEXT
(pub.SendMessage("ENABLE NEXT")
).
I want to have gui_btn_panel.py
catch that message, but it doesn't seem to.
If I have confused some, let me know! Hopefully someone can help me with this.
This is weird. I use the pubsub that is included in wxPython itself and have never had that issue, but I do it slightly differently: http://www.blog.pythonlibrary.org/2010/06/27/wxpython-and-pubsub-a-simple-tutorial/
Hopefully that will help you out. If not, you can try posting to the official wxPython mailing list. I know the author of pubsub is there and he answers questions there.
精彩评论