On 1/12/10 2:13 PM, has wrote:

You don't pass self to a bound method in Python. Delete the ('----', 'self', 
...) tuple.



My app crashes when I do that. Here's the error message:

TypeError: Can't install event handler 'CoKvdman': expected 2 parameters but function 'getDomain' has 1.
logout

I've gotten things to load, instead, by refactoring the code to import aemreceive into a brief "main" module, into which I also import my app class, like this:

import aem
import aemreceive
from quickwho_main import quickwhoApp

#expose basic functionality to AppleScript
def getDomain(domain):
    quickwhoApp.searchterm = StringVar()
    quickwhoApp.searchterm = ""
    quickwhoApp.searchterm.set(domain)
    quickwhoApp.searchfield.insert(0, domain)
    quickwhoApp.servertree.selection_set('Default')
    quickwhoApp.getInfo()

aemreceive.installeventhandler(getDomain,
                     'CoKvdman',
                      ('----', 'domain', aemreceive.kae.typeUnicodeText)
                        )

app = quickwhoApp(None)
app.mainloop()

This plays nicer with aemreceive's procedural API.

Thanks,
Kevin


--
Kevin Walzer
Code by Kevin
http://www.codebykevin.com
_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
http://mail.python.org/mailman/listinfo/pythonmac-sig

Reply via email to