Subject: Re: [orca-list] Help with Accerciser iPython console
Date: Fri, 8 Oct 2010 13:28:34 -0400
Thanks, Chris.
Your suggestion looked really good and
I had high hopes, but sadly, the insertText line results in the same TypeError:
could not marshal arg 'position'.
I did ask my question on the python
mailing list - if they reply, and if it helps me, then I will report back
here.
Thanks again,
Carolyn
From:
Christopher Brannon <chris the-brannons com>
To:
orca-list gnome org
Date:
08/10/2010 12:13 PM
Subject:
Re: [orca-list] Help with Accerciser
iPython console
Sent by:
orca-list-bounces gnome org
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!