Winforms in ironpython

is there any reference pdf available to learn “How to create winforms in ironpython” ? Because i would like to create forms in dynamo to distribute dynamo scripts to my workmates who don’t know anything about Dynamo.

I would take a look at Data-Shapes package. I believe it’s all custom nodes which mean you could dissect them, or just use them if they would work for your needs.

i am using data shapes nodes. the problem is when we distribute the script we have to make sure all the resources having the same dynamo version . so i would like to make my own forms.

There are several resources on the web, I used these when I started:

http://www.voidspace.org.uk/ironpython/winforms/index.shtml
http://zetcode.com/tutorials/ironpythontutorial/

Once you get the basics any question related to it you can fins solutions in stackoverflow or checking for Winforms doc:

https://docs.microsoft.com/en-us/dotnet/framework/winforms/

2 Likes

Even if you make your own, you will still need to make sure you have proper versioning and use applicable references. The nice thing about a package is that you only need to update a single location and everyone instantly gets the newest version. This makes maintenance MUCH easier.

2 Likes

Completely agree, although I don’t see mayor changes coming until Ironpython 3, so it is pretty much reusable for a long long time.
But aside from that, it is nice to have some customized stuff, learn Winform is a good investement as you can use it later for C# addins or just keep them in python developing tools over pyRevit.

1 Like

the last link you have given is for c#. how it will help for a python user?

well, ironpython runs over .NET, and when you import clr is to communicate with the objects created in C#. For example, when you retrieve parameters in ironpython with param = element.LookupParameter(paramName) and later set that parameter with param.Set(paramValue) you are in fact using objects and methods already created in C#.
In a same manner, Windows Forms are already classes ready to use in ironpython, using python syntax but manipulating C# objects. SO, the docs are for C#, but the objects and methods are usable in ironpython.

1 Like

@architectcoding great links, thanks!

1 Like

i created a script without using any dynamo nodes. can i use the same python codes to create the Add in? If possible how? i found some topic but nobody given a straight answer

Two options: