[Ironpython-users] [PythonHidden] not working?

Jeff Hardy jdhardy at gmail.com
Thu Oct 9 16:56:32 CEST 2014

On Mon, Oct 6, 2014 at 12:57 AM, rabidgremlin <rabidgremlin at gmail.com> wrote:
> Hi there,
> I'm using IronPython to add scripting to my app. I have some classes with
> methods that I don't wish to expose to the IronPython scripting engine.
> Doing some googling it looks like I should be able to add [PythonHidden] to
> my class methods to achieve this, however it doesn't appear to work.
> eg I have a Layer class with the following method
> [PythonHidden]
> public Canvas GetLayerCanvas()
> {
>    return layerCanvas;
> }
> In my Python script I am still able to call this method and a dir() command
> on a Layer object results in:
> ['AddElement', 'Delete', 'GetElements', 'GetLayerCanvas', 'GetName',
> 'MoveBottom', 'MoveDown', 'MoveElementBottom', 'MoveElementDown',
> 'MoveElementTop', 'MoveElementUp', 'MoveTop', 'MoveUp', 'RemoveElement',
> 'SetName', '__class__', '__delattr__', '__doc__', '__format__',
> '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__',
> '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__',
> '__subclasshook__']
> Any ideas?

[PythonHidden] requires the class to have the [PythonType] (or
[PythonModule]) attribute.

- Jeff

More information about the Ironpython-users mailing list