Eto.Forms class inheritance and initialization argument issue

Hi bob,

When you inherit from a .NET class in IronPython the constructor is derived before the derived class constructor.

import Eto.Forms as forms
import Eto.Drawing as drawing

class WebDialog(forms.Form):
    @classmethod
    def create(cls, width=400, height=200):
        instance = cls()
        instance.initialize(width, height)
        return instance

    def initialize(self, width, height):
        self.Size = drawing.Size(width, height)
        self.Title = "Test WebDialog"

if __name__ == "__main__":
    dialog = WebDialog.create(500, 500)
    dialog.Show()

I hope that helps clarify things a little bit,
Farouk

4 Likes