18 votes

PySide vs .NET WinForms for a Desktop GUI App in 2023?

Hello Folks,

For an upcoming side project - a Desktop GUI app, open source, Apache 2.0 licensed, I'm slightly confused regarding what technology to use.

Skills wise, C#/WinForms should be my natural choice as that was the primary technology I had worked on before losing employment at my former company few years back and getting into freelancing. But post my freelance experience, I taught myself things like open source and Python as it came with the territory, and now PySide2 is also a running candidate in this race.

The goal here is to be as much ubiquitous as possible - that my app should be easy to just "download, extract and run" by as many people as possible. A couple decades ago, a .NET GUI library targeting Microsoft Windows platform would have been the clear choice here as most people used Windows OS and targeting that platform meant being ubiquitous.

But over the last few years, I've observed that Windows OS has been continuously losing its market share to Linux Distros and Mac OSX, mostly due to some incorrect decisions and strategic blunders by the former than some ground breaking or revolutionary innovation on part of the latter. This means .NET or WinForms is no longer the ideal choice today if you want to be cross-platform and ubiquitous.

This lead my research to some other toolkits like the Java Swing library, for example. It's old but classic, not a bad choice at all in this case, platform independence is Java's biggest selling point. However, the app I'm making is non-trivial and slightly performance intensive, and Swing GUIs are known to be sluggish on PCs unless you ensure a good supply of RAM by tweaking the JVM settings. I'm also not very experienced in Java to be able to handle those situations in case they arise.

I also considered Lazarus IDE/Object Pascal, it is also not a bad choice. It is open source, used as the primary course language across many Universities in Europe and most importantly, still maintained and developed. But guess I will have to teach myself a whole new paradigm along with a programming language in case I go this route.

Finally, Python is something I've almost settled on for this project. It's a language that I'm very fond of and it has helped me survive through the tough times in the freelance market. It also has a vibrant ecosystem and rich repository of user contributed packages at PyPI.

Now, I've worked on the default Tkinter library in past but somehow felt that it's quite limited in terms of making the GUI more flexible and "tweakable", especially a non-trivial one having several container widgets, syntax editors, menus and drop-downs, trees and list views, etc. PySide2 is, from what I understand, a better choice in this regard as it is comprehensive and based on the time-tested Qt interface. It is not only very easy to code and maintain but also very easy to port across various platforms.

What do you think? In which direction should I go here?

14 comments

  1. [2]
    knocklessmonster
    Link
    Why not PyQt? The Eric IDE has tight integration for it including a form builder, both are in PyPI and you can straight up just use the QT C++ library docs to help with methods I haven't use...

    Why not PyQt? The Eric IDE has tight integration for it including a form builder, both are in PyPI and you can straight up just use the QT C++ library docs to help with methods

    I haven't use PySide, but PyQt + Eric hit a want I had for a VS style Python+QT environment.

    9 votes
    1. akselmo
      Link Parent
      Seconded for PyQt, it's pretty nice.

      Seconded for PyQt, it's pretty nice.

      2 votes
  2. lux
    Link
    Newer .NET is fully cross platform and so is the GUI library Avalonia. I did a few projects with Avalonia in the past and like it. Especially in terms of performance .NET will be much better than...

    Newer .NET is fully cross platform and so is the GUI library Avalonia. I did a few projects with Avalonia in the past and like it. Especially in terms of performance .NET will be much better than Python. You wrote something about multithreading, while this is possible with Python it is natively ingrained into .NET and is a breeze to use. I love current gen .NET a lot. :)

    Another option would be to write a local webapi service and a website which you then wrap into Electron or Tauri or use React Native. Although I had a bad experience with React Native once I actually wanted to properly debug things or when the project simply got bigger.

    8 votes
  3. bj-rn
    Link
    Maybe check out Avalonia?

    Maybe check out Avalonia?

    7 votes
  4. [3]
    Comment deleted by author
    Link
    1. [2]
      pyeri
      (edited )
      Link Parent
      I've looked up wxWidgets, guess it'd be a bit tedious to use that with a high level language such as Python bindings? How good is wxWidgets at drawing containers within containers? Things like...

      I've looked up wxWidgets, guess it'd be a bit tedious to use that with a high level language such as Python bindings? How good is wxWidgets at drawing containers within containers? Things like timer controls and multi-threading? Python does have support for multi-threading but implementing it in desktop GUI isn't a thrilling experience in most cases I think.

      1. kej
        Link Parent
        There is a wxPython project (https://wxpython.org/) that has done the work of wrapping wxWidgets in Python, but my impression as someone who has only scratched the surface of either one is that...

        There is a wxPython project (https://wxpython.org/) that has done the work of wrapping wxWidgets in Python, but my impression as someone who has only scratched the surface of either one is that PySide has a lot more momentum and mindshare in the Python world.

        1 vote
  5. brogeroni
    Link
    This isn't native, but IMO there's nothing easier than using modern ui frameworks, so I'd personally use something like electron / tauri + web framework of your choice

    This isn't native, but IMO there's nothing easier than using modern ui frameworks, so I'd personally use something like electron / tauri + web framework of your choice

    5 votes
  6. [3]
    Tupats
    Link
    Look up Flutter, Dart is not too far from C# so you'll feel good, and the developer experience is top notch, at least for me. What kind of performance are you looking for?

    Look up Flutter, Dart is not too far from C# so you'll feel good, and the developer experience is top notch, at least for me.

    What kind of performance are you looking for?

    3 votes
    1. [2]
      pyeri
      Link Parent
      It's a productivity tool/app with features like notes, brain-storming, tracking of milestones/hours being worked, etc. I will need multi-threading for things like showing reports or editing notes...

      It's a productivity tool/app with features like notes, brain-storming, tracking of milestones/hours being worked, etc. I will need multi-threading for things like showing reports or editing notes while the tracking is going on in the background timer, for example. This will also require a comprehensive widget library for text-areas, drop-downs, etc. Does Flutter/Dart have an IDE with widget library - which can also be ported across all platforms?

      2 votes
      1. Tupats
        Link Parent
        Sorry for the late reply - I think for these tasks, you would love Flutter. For multithreading Dart has isolates. For IDE, Android Studio and VSC are both first class citizens, and Flutter has all...

        Sorry for the late reply - I think for these tasks, you would love Flutter. For multithreading Dart has isolates. For IDE, Android Studio and VSC are both first class citizens, and Flutter has all the material design widgets built in, you can use them for all platforms. If you want native feel, there are 3rd party packages, but I don't have much experience with those.

        1 vote
  7. Greg
    Link
    Very strong recommendation for a declarative UI framework: React Native (which can render to native widgets per-OS, or directly at the pixel level using Skia) or Flutter (similar to React Native...

    Very strong recommendation for a declarative UI framework: React Native (which can render to native widgets per-OS, or directly at the pixel level using Skia) or Flutter (similar to React Native Skia) if you want native level performance, or any modern web UI in Electron if you can accept the memory overhead.

    React Native and Electron both use Typescript internally, but you can bundle a python “backend” in the same executable using something like zerorpc if you prefer. It sounds like you’re looking for non-blocking behaviour rather than threading specifically for CPU-heavy tasks, so either option should be fine there. Flutter uses Dart, which I’m not personally familiar with but as far as I know is also a solid choice!

    If it were me I’d be going with React Native and Typescript end to end for something UI focused like this, just to save on moving parts and dependency/runtime management. There are also bindings for C++ and Rust via JSI if you’re doing things that need real systems programming, but my experience is the vast majority of UI apps are more than fine using the wrapped native modules that already exist.

    3 votes
  8. Englerdy
    Link
    I have minimal experience with making a GUI for a program other than using Visual Basic for a class in highschool. I recently started working on a Python project that I wanted a front end for,...

    I have minimal experience with making a GUI for a program other than using Visual Basic for a class in highschool. I recently started working on a Python project that I wanted a front end for, however I don't want to have to learn a whole new language right now to accomplish the task. Programming isn't a core strength for me, however I've become proficient with Python and was hoping to leverage that. I'm familiar with Web design, but not enough to make a web front end for my app from scratch.

    I came across this project called NiceGUI for creating Python guis. It creates a web front end and server back end simulationsly, but you only have to write fairly pythonic code. This is what I've settled on for my project unless I come across something even easier to spin up a form based front end. A big draw to a web based front end for me is being able to make a GUI that can easily scale at different resolutions and window sizes. It sounds like NiceGUI might work well for your project too.

    1 vote
  9. babypuncher
    Link
    For Windows development, WinForms is old hat. I would at least move up to WPF. As far as cross-platform solutions go, I've never met one I actually loved. This is because at best they result in...

    For Windows development, WinForms is old hat. I would at least move up to WPF.

    As far as cross-platform solutions go, I've never met one I actually loved. This is because at best they result in software that only uses the lowest common denominator platform features, and at worst they feel very obviously not natively designed for the target platform. So it really boils down to what you're familiar with and what concessions you are willing to make.

    The cross-platform options that might best suit your existing .NET skillset would be MAUI, Avalonia, or Uno. All of these share strong similarities with the aforementioned WPF, specifically their use of XAML.

    1 vote
  10. adutchman
    Link
    If you are willing to learn something completely different, you could look into Rust UI frameworks. They work on litterally any platform, you can even run your desktop app in the browser with...

    If you are willing to learn something completely different, you could look into Rust UI frameworks. They work on litterally any platform, you can even run your desktop app in the browser with Webassembly. I don't have any personal experience with Rust UIs, but the language itseld is great.

    1 vote