Re: [orca-list] Help with Accerciser iPython console



Carolyn MacLeod <Carolyn_MacLeod ca ibm com> writes:

   <grin> I guess I thought that it must be a novice python question...
   basically, "How do I pass by reference?"  :)

Carolyn,
Python functions can't take reference parameters, in the Algol sense.
Under the hood, everything is passed by reference in Python.  However,
some objects, such as integers, strings, and tuples, are immutable.

I don't know anything about accerciser.  Does it use ctypes?  Maybe
insertText needs a C pointer to a C integer.  You can do that like this:

import ctypes
pos = ctypes.c_int(5) # Object representing a C int
pos_ptr = ctypes.pointer(pos) # pointer-to-int
t.insertText("brown", 5, pos_ptr)

insertText probably puts a new value into pos.  You can convert
it to a Python integer using pos.value.

This is really a shot in the dark; I hope it helps!

-- Chris

Attachment: pgpmb4qwRobmw.pgp
Description: PGP signature



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]