FAQ

On 11 Jan, 15:54, Kevin Walzer wrote:
I'm trying to make use of a Python library, aemreceive, that provides a
procedural API. (aemreceive is a library for Python on the Mac that
allows the application to receive and respond to Apple Events.)

My Python apps basically run in a single fooApp class, and everything
runs inside the class. To launch the app (my apps are Tkinter-based), I
use something like this:

if __name__== '__main__':
? ? ?app = fooApp(None)
? ? ?app.mainloop()

In keeping with aemreceive's procedural API, I've added a runCommand
function inside the app class to provide some basic functionality in
response to Apple Events it will set some objects/variables, then
display the output in the app. In my code it looks like this:

? ? ?def runCommand(string):
? ? ? ? ?self.searchterm=string
? ? ? ? ?self.servertree.selection_set('Default')
? ? ? ? ?self.getInfo()

When I test this command, I get an error from Python: "self" is not
defined.
Is runcommand is method of your class? In that case you should define
it as:

def runCommand(self, string):
...

HTH

--
Arnaud

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 2 of 3 | next ›
Discussion Overview
grouppython-list @
categoriespython
postedJan 11, '10 at 3:54p
activeJan 11, '10 at 5:05p
posts3
users3
websitepython.org

People

Translate

site design / logo © 2022 Grokbase