Wpf or winforms?

I am confused about creating forms in python, recently I started to create form by windows form, but I heard that it is better to use wpf instead? is it true?
and visual studio seems do not support python windows form anymore, any recommended software? Now I am manually changing C# code from visual studio to python…

Wpf has broader application I think and a higher ceiling, I don’t see pople using winforms much unless they want to do something very simple.

1 Like

thank you @GavinCrump :slight_smile:
now start to learn wpf instead of winforms

Hi,

So I think a major advantage of WPF is that you can separate the language of designing the interface (XAML) from the code behind (mostly C# but ironpython is possible).

This makes it easier to design a sophisticated interface, especially if you’re in VS.

However the initial learning curve is going to be much steeper, because you’ve got to get your head around how the coding works and the connection between the codes and structuring both languages.

So Winforms is probably going to do you just fine functionally… Just look at how much you can do with DataShapes… Then when you’re comfortable with how you make everything work, perhaps move on to WPF then?

But if you want to go straight for WPF, that is good also, but it might just take a bit longer for you to get your first projects running.

Hope that helps,

Mark

5 Likes

thanks for your advice! :slight_smile: :slight_smile:

In the context of having some user interaction from within python nodes in Dynamo I’d rather use Winforms.
The reason for me is that I wouldn’t have to use a separate XAML file and I think it would be simpler.
I have been using a lot of WPF with pyRevit though, and I think that making that type of more sophisticated user interface would be more difficult in Winforms.

3 Likes

I wouldn’t say either is better or worse than the other; Author preference in the context of the project.

WPF does have a higher ceiling, but that doesn’t mean it’s the ‘right’ tool - you can always learn the other later on.

3 Likes