python - sendMessage() takes at most 3 arguments (4 given) error in wxPython -


i developing gui app python v2.7 , wxpython v3.0 on windows 7 os. using pubsub module sending information main gui thread update gui. using wx.callafter() send messages main gui loop.

problem: in programm there instance need send 2 lists using wx.callafter() shown below:

wx.callafter(pub.sendmessage, 'update', lista, listb) 

i following error:

sendmessage() takes @ 3 arguments (4 given) 

any work around without modifying method receiving messages?

wx.callafter(pub.sendmessage, 'update', lista) works charm.

thank time.

answer: using following imports

from wx.lib.pubsub import setuparg1 wx.lib.pubsub import pub 

i should use following solved problem:

from wx.lib.pubsub import setupkwargs wx.lib.pubsub import pub 

you can send messages keyword value, have this:

from wx.lib.pubsub import pub  ... wx.callafter(pub.sendmessage, 'update', arg1 = lista, arg2 = listb) 

the arg1 , arg2 must same listener arguments (so listeners of given topic ('update'), , senders topic, must use same argument names; order not matter, python's keyword arguments).

note: above assumes using recent version of pubsub, pubsub's default messaging protocol, rather v1 or arg1. try printing pub.version_str or pubsub.version (the latter in latest only, wxpython phoenix, not 1 using). also, if there from wx.lib.pubsub import setupv1 or from wx.lib.pubsub import setuparg1 using old pubsub, accepts 1 message data, arg name not needed (this explain problem).


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -