我使用 wx.lib.pubsub (Windows, Python 2.6)
使用解释器运行我的应用程序时,pubsub 的版本是 1
当我编译并运行我的应用程序时,pubsub 的版本是 3
为什么 ?如何强制编译版本运行 pubsub api v1?
from distutils.core import setup
import py2exe
from distutils.core import Distribution
setup(
console=[
dict(
script='test.py'
)
],
options={
'py2exe': {
'packages' : [
'wx.lib.pubsub'
],
'includes': [],
"excludes" : [],
"dll_excludes": [ 'tcl85.dll', 'tk85.dll', 'mswsock.dll', 'powrprof.dll']
}
},
)
from wx.lib.pubsub import pub
publisher = pub.Publisher()
print pub.PUBSUB_VERSION
EVENT_NAME = "test_pubsub"
def listener(data):
print data
publisher.subscribe(listener, EVENT_NAME)
publisher.sendMessage(EVENT_NAME, data="toto")