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




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'.

Just for grins, I also tried:

import ctypes
pos = ctypes.c_int(5)
pos_ptr = ctypes.pointer(pos)
t.insertText("brown", 5, *pos_ptr)

but this results in a MemoryError in Accerciser.

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!

-- Chris
[attachment "att63vbx.dat" deleted by Carolyn MacLeod/Ottawa/IBM] _______________________________________________
orca-list mailing list
orca-list gnome org
http://mail.gnome.org/mailman/listinfo/orca-list
Visit
http://live.gnome.org/Orca for more information on Orca.
The manual is at
http://library.gnome.org/users/gnome-access-guide/nightly/ats-2.html
The FAQ is at
http://live.gnome.org/Orca/FrequentlyAskedQuestions
Netiquette Guidelines are at
http://live.gnome.org/Orca/FrequentlyAskedQuestions/NetiquetteGuidelines
Log bugs and feature requests at
http://bugzilla.gnome.org
Find out how to help at
http://live.gnome.org/Orca/HowCanIHelp



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