I have been exploring the use of the free C# IDE from www.icsharpcode.net.

As well as designing a form for C#, you can design a form and save it as xml.

 

A new XmlForm can be created by the menu sequence File,New,File,Misc,XmlForm.

 

I have written a module to convert the xml file to a python class that references

PythondotNet. This class will draw the component controls on the form but does not

have any event handlers.

 

The name of the class is taken from the name element of the xmlForm.

 

It seemed to me desirable to leave this generated class untouched.  Another

class can inherit the generated class and add the event procedures.

 

I attach

1. the xmlForm, Form1.xfrm

2. the python equivalent, Form1.py

3. the derived class and main function, App1.py

4. the module PythondotNetForms.py that contains the conversion function

             XMLToPythondotNet(filenameXML,filenamePythondotNet)

             this module uses Frederik Lundh's ElementTree to process

             the xml.

             

The function XMLToPythondotNet contains a dictionary of properties mapped to property

type.  This could be expanded. Alternatively properties not set in the conversion

could be set programmatically afterwards.

 

Pythonistas may find my code ugly. I have a VB.net mindset.

 

David Powell