Embedded python adding variables linking to C++-Variables / callbacks
iwl
Ingo.Wolf at gmx.de
Thu Dec 7 09:33:51 EST 2006
gagsl-py at yahoo.com.ar schrieb:
>
> Write some C functions -callable from Python- which will be used to get
> and set the variable value.
> >From inside Python, declare a property with getter and setter which
> will call your C functions.
> This works fine for object attributes. If you want to trap references
> to local or global "variables", I think you could provide customized
> dictionaries for locals and globals, but I'm not sure if it works
> really.
>
Thank you I will try this.
What I found out up to now is to create a class inherited from an
fitting type
and overwrite the __setitem__ and __getitem__ method but haven't test
this
yet, something like that:
class test(int):
__setitem(self, value)__: C-Set-Func(value)
__getitem(self)__: return C-Get-Func()
x=test()
x= -> C-Set-Func called
y=x -> C-Get-Func called
something seems not yet correct
More information about the Python-list
mailing list