how can create a user interface in Dynamo as shown below
Using WinForms or WPF.
WPF is I think more modern and futureproof.
Probably could be done within a Python node, but much easier in C# (like ZeroTouch nodes)
Hi @SHIBUJOSE,
You can do this by creating your own ViewExtension. ViewExtensions are written in C# and Xaml. Have a look at this workshop by the Dynamo Team…
Dynamo BIM - Dynamo Extensions
and have a look at the example projects from Dynamo GitHub…
Autodesk AU 2018 Workshops - Developer
This should hopefully get you started. Hope this helps.
EDIT: Hang about, I may have misunderstood, do you want to make this a node in your graph? Either way you will still need to use C#/xaml but you might want to look at the following…
BiMorph - Zero Touch Developer in 75 mins
Dynamo Developer Wiki - Zero Touch Nodes
and
Cheers,
Dan
Means, we can’t write such interfaces in python; correct? Need to use C# ?
I think WPF will not work in python. but winforms will work. this is my guess only
It would be easier in C# in my opinion. You could write in python if you like, but would be more painful.
Both WPF and Winform will work with IronPython. It’s a lot of work to make it happen from scratch.
RevitPythonWrapper has a module that helps building simple dialogs.
Don’t know about WPF as well, but for winforms see here for example, seems possible:
http://www.voidspace.org.uk/ironpython/winforms/part2.shtml
Here a form in python node context within Dynamo:
(although a c# form is used)
Also I think such an interface would get quite a complex code…I don’t think the python code environment within Dynamo is well suited for writing longer pieces…
I agree with @maciek.glowka, trying to write what would be some quite extensive code would be very painful in python. Have a look at the Data|Shapes nodes for an example of python UI. Much much easier with C#/WPF.
is it possible to write forms in c# and call that in python for Dynamo?
Yeah, I can’t see why not, you’d have to import your class library and have a constructor that takes your data and displays in the form… but if you are going to do that, why wouldn’t you just make the whole node in c#? Would make more sense.
I agree with @Daniel_Woodcock1, this would be utterly pointless when you could simply compile your program and import it via ZT.
Using C# for UI with all the advantages an IDE brings far surpasses using Python and a text editor to do the same thing. You can’t even see the view designer (with Python) and the amount of time you’d waste writing every line of the code-behind (which C# win forms and in many instances, WPF, does for you automatically) would far outweigh the amount of time it would take you to learn C# and write the app in either of those frameworks.