PythonCOM: implementing properties with parameters

Mark Hammond MarkH at ActiveState.com
Wed Oct 17 19:29:18 EDT 2001


Larry Howard wrote:

> How would I implement an interface with a property such as this using PythonCOM?
> 
> dispinterface IDispComponent {
>   ...
>   [id(0x60020003), propput, helpstring("property ComponentParameter")]
>   void ComponentParameter([in] BSTR Name, [in] VARIANT rhs);
>   [id(0x60020003), propget, helpstring("property ComponentParameter")]
>   VARIANT ComponentParameter([in] BSTR Name);
>   ...
> }


The propget can be implemented by creating a function 
"ComponentParameter".  The propget can not currently be implemented - 
this was discussed on this list earlier this year (or maybe even 
earlier).  win32com/server/policy.py needs to have support added in the 
_invokeex_ function, which I would be happy to coordinate.

It is a shame they use a property when it takes an argument - it defeats 
the purpose of properties IMO.

Mark.




More information about the Python-list mailing list