How to implement an override method in IronPython

Posted by Adal on Stack Overflow See other posts from Stack Overflow or by Adal
Published on 2010-04-24T12:40:38Z Indexed on 2010/04/24 12:43 UTC
Read the original article Hit count: 400

Filed under:
|
|

I'm trying to implement a WPF control in IronPython and I'm having trouble implemented the override methods. The code below fails with this error: TypeError: expected int, got instancemethod.

If I rename the VisualChildrenCount method, the exception is not raised anymore, but the control doesn't work.

So how do I tell IronPython that the method is an override?

class PaintCanvas(FrameworkElement):

    def __init__(self):
        self.__children = VisualCollection(self)
        dv = DrawingVisual()
        self.__children.Add(dv)

    # In C# this should be: protected override int VisualChildrenCount
    def VisualChildrenCount(self):
        return self.__children.Count

    # In C# this should be: protected override Visual GetVisualChild(int index)
    def GetVisualChild(self, index):
        return self.__children[index]

© Stack Overflow or respective owner

Related posts about ironpython

Related posts about wpf