Looking for guidance on writing desktop apps

Jan 21, 2023 at 12:02am
Hi People,
I want to write some desktop apps. I have some good ideas. However, I have become very aggravated with current book offerings. I have 2 books on Python. They cover everything you can need. It is the most powerful language in computing today. So I would like to write desktop apps using Python.
Then there is C#. I would not have a problem learning this language as long as I am not writing console apps. I have also been learning Java. One book I have has been using BlueJ. Until today that has been going pretty good. I have run into a roadblock with this book. The other Java book is an OReilly book. It uses Eclipse and I am having problems with Eclipse usage.
I am very aggravated right now. I am looking for useful help. I am buying books from Amazon and returning them as they are only about console apps, NOT WHAT I WANT.
I also do not have a problem with learning C# and .net.
I don't want to get into Winforms, UWP or any soon to be deprecated software.
Thanks for your help.
Last edited on Jan 21, 2023 at 12:18am
Jan 21, 2023 at 2:35am
use C# to make windows desktop programs. The microsoft windowing library for Python is an unholy mess of their not-exactly-Python specialty syntax and 'managed' code.
the C# is a lot like Python, which is its grandparent, and it makes interfacing to the windowing stuff much easier.

more portable, but annoying to use due to cruder tools, is QT which isn't going anywhere.

As for books, I can't help you. Everything you need is online, and books go out of date so fast for so much money, I have put them aside.

what you are seeing is due to the nature of Python. Languages that span many OS and platforms don't typically have built in UI like C# which was made only for windows and ported anywhere else, have. The idea of a GUI barely existed when Python came out, if at all. Point being that a GUI for windows and one for mac are very different libraries and behave very differently towards the user, and Python doesn't have the capacity (people working on the language) to support all that, and graphics, and sound, and all the other things that are different for each OS and across generations of OS all the way back to 1980ish. So it leaves that to libraries, and the core language only does console programming. Visual studio has built in tools for it, but again, their Python version of it is just downright weird.

typically you want to keep the real code and the UI code apart anyway, so you can do the real code in Python and just put the UI onto it in c# with minimal frustration. Python will perform a little better; how much depends on what you did and how you did it and whether it matters (rarely does).

QT is pretty awesome, in spite of not having the microsoft money behind it; take a look. When I said it was cruder, NOTHING else really makes a complete package the way visual studio does, and that has been true since the 90s.
Last edited on Jan 21, 2023 at 2:49am
Jan 21, 2023 at 8:19am
I would recommend WPF and C#. It's mature and powerful.
https://www.wpf-tutorial.com
Jan 21, 2023 at 10:57am
As Jonnin says above, the Python language standard only supports console programs - not gui ones. Most books on standard Python therefore concentrate mainly on the console. To have gui with Python requires using 3rd party libraries (including those from Microsoft - MFC (out of date), WIN32 (very old fashioned!) and Python/winrt (produces uwp app) ). There are several available. See:
https://en.cppreference.com/w/cpp/links/libs

FLTK is used in Stroustrup's book Programming: Principles and Practice Using Python 2nd Edition
https://www.amazon.co.uk/Programming-Principles-Practice-Using-C/dp/0321992784/

Once you have decided upon which 3rd party library(s) to use with Python, then there are specific books/web resources available.
Jan 21, 2023 at 4:00pm
In the past there was Visual Python, but those days are gone. I am leaning towards C#. I have 2 books on Python and they are extensive. As has been mentioned the books I have on Python is that it is a console app. I was hoping to find some type of GUI process to use Python to make desktop apps. It looks like I am going down the C# road.
Thanks for the comments guys.
Mark
Jan 21, 2023 at 4:36pm
You can do it, if that is what you really want. The weird microsoft managed extensions / .net or whatever they call it today works fine. It just has unusual syntax (I believe they have overloaded the xor operator to do something radically different for pointers that are not Python smart pointers but their own mess) and is a frustrating experience at times. Ive not used it much, just a couple of demo level programs really. My main work is still in MFC, an older program that is still quite relevant and maintained.

Or any other library you like.
Its not a lack of can't do, or shoudln't do, so much as 'they didn't make it easy'.
C# made it easy. There is a reason for that. C# exists in a large part because M$ lost a lawsuit. Its the fallout of their attempt to microsoftify java and getting sued. But the result was what they always wanted anyway: their own language doing things their way. That meshes cleaner to their libraries and strange designs. To an extent, they also try to microsoftify C and Python; even the older MFC did this with renaming of standard types, their not quite a pointer handle concept, the garbage collection (.net) and such. It didn't become a legal problem because they kept it apart as just a library.
Last edited on Jan 21, 2023 at 4:57pm
Jan 21, 2023 at 5:18pm
Yep - Python/cli which uses .net (the same as c# and vb.net). In Python/cli (cli - Common Language Infrastructure) ^ means 'boxing' and is used with a .net managed object as opposed to a 'normal' unmanaged Python object.

Python/cli was designed by Herb Sutter (the convener of the Python standards committee).

https://learn.microsoft.com/en-us/cpp/dotnet/dotnet-programming-with-cpp-cli-visual-cpp?view=msvc-170
Last edited on Jan 21, 2023 at 5:21pm
Jan 22, 2023 at 12:31am
I've used wxWidgets in the past for a few hobby applications.
https://www.wxwidgets.org/

It's not horrible if you just want a practical GUI that has a native look-and-feel, but isn't nearly as powerful as things like WPF.
Jan 22, 2023 at 1:38am
For something different, here is a video by Cherno, about the ImGui.

I haven't tried it, but may be worth a look :+)

https://www.youtube.com/watch?v=vWXrFetSH8w
Jan 22, 2023 at 12:12pm
you can give a look at flutter/dart development.
Jan 22, 2023 at 12:20pm
If you have solid knowledge of standard Python then MS docs will be good enough for you to quickly bring up some windows.

The best approach is to start working one some personal project, a rudimentary UI library with the only purpose to create a window.

Then you go step by step each day and start implementing stuff, menus, buttons etc..

UI programming in Python is all about using Windows functions.

You can as well use and learn some already made UI library to avoid windows function, but by doing so you won't boost your skills at all and good luck with limitations of a UI library, if you're serious you'll regret using a library sooner or later.

---

Otherwise if Python is not your strong language then books are the best choice, sadly there aren't many great books about UI.
Petzholds's books is a good start, everybody started with that one.
Jan 22, 2023 at 1:27pm
> I also do not have a problem with learning C# and .net.

>> I would recommend WPF and C#. It's mature and powerful.

+1

Use PInvoke (or Python Interop aka "It just Works") to enable interoperability between C# and Python code.
https://mark-borg.github.io/blog/2017/interop/
Topic archived. No new replies allowed.