+ 3

GUI applications in Python vs learning C++?

I'm a novice programmer with intermediate python capabilities. I've made small programs that I use when I write stories, mostly things to help me with naming people and places and nature things. Lately, I've been looking into giving them a GUI and found it is *possible* with Python. Question is, though, are whatever headaches I may face along the way worse, than any headaches I would face along the way of learning C++? I have basic knowledge in a few scripting languages, and the brackets and semicolons won't be an issue. Just the learning curve. (Of course, there's always an argument to be made for the wonder of learning new things. I just have a tendency to want to learn new things over using what I already know, so I rarely complete my projects <.< ) Edit: Bottom line: Is C++ worth learning to create GUI projects, or is Python fine for small projects?

4th Jan 2020, 10:49 PM
Breagha Derryth
Breagha Derryth - avatar
47 Respuestas
+ 8
Qt5 is a cross-platform library that can be used with both Python and C++. You can always compile python to run on different OS , so you don't have to worry about that for the moment.
4th Jan 2020, 11:31 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 6
Engin Demir I searched what you said. It is mostly using incompatible versions of python with cython. It is not a big issue, and can be easily be fixed by reinstalling the right version of Cython. In terms of compiled program, there aren't any problem with it. Once compiled, the binary file will run on any linux system, with python or without. EDIT: If you have any specific posts, please link them.
6th Jan 2020, 3:48 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 5
Breagha Derryth C++ is much faster. If you're going to build heavy apps(Immage manipulation, Videos, Heavy calculations..) then you might need to use a faster language. However, you can write the GUI in python, and the base of the app with a faster language, so it's not z real problem. Good luck!
5th Jan 2020, 12:31 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 4
Martin Taylor I said python can be compiled, and didn't say it was a compiled language.
5th Jan 2020, 12:11 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 4
Breagha Derryth Tkinter comes by default on python, but I personally think it is an ugly choice. There are many GUI frameworks out there that look much better that the default Tk framework.
5th Jan 2020, 12:23 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 4
You said small program and meaning a simple as well I really think that you know the answer before you asked this question "python may be good choose for this but slow" Okay let me tell you that python GUI won't be a turtle on you machine ,it will be very good response but not extremely fast I'm trying kivy frameworks for python as it's a very easy to learn , to code , to even create a professional gui with a set of widgets kivymd which make coding a gui piece of cake . One code can super easily ported for any platform a cross platform gui The disadvantages Not very big community it's not easy to install "buildozer " and, I can help you facing errors with buildozer to make android app if you want But with locking to c++ it over killing to learn creating GUI for a simple gui but for run time or minimum latency and a big projects
5th Jan 2020, 7:31 AM
Kyrillos Akram
Kyrillos Akram - avatar
+ 4
Kyrillos Akram this is a learning platform, not learn-as-fast-as-you-can platform. We don't know what he is going to do with the app, maybe a photo editor, video editor, 3d game, hezvy math calculations.. we don't know. So it is important to know how slow python can be when running these kind of apps. I also explained he can use python for GUI only, and another language for the base.
5th Jan 2020, 8:18 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 4
Who didn't know that python are slow ?! but as I saw he already checked python gui frameworks so he should know about kivy but what we don't really know the time to finish this It okay to find some preparing python solutions for simple purpose As a embedded software development I use c for microcontroller and to make it communicate with pc or smartphone use python and kivy So I already know how python slow it runtime but also how it slow to develop program with c or c++ and learning as fas as possible is a learning
5th Jan 2020, 8:43 AM
Kyrillos Akram
Kyrillos Akram - avatar
+ 4
Ahmed Khaled my advice is start with C if you truly want to master C++ because after learning C u can relate most of the basic concepts. Although it is not necessary. You can do just fine without C, but as C++ is derived from C you can give C a shot. After C, master basics of C++ do not be too hasty and start with OOPS and STL.
6th Jan 2020, 7:32 AM
Milind Yadav
Milind Yadav - avatar
+ 4
Engin Demir I have never tested it on windows, because I don't have any windows machine I can test it on, and my laptop is too weak to run virtual machines. But there are some tools for it, and I'm almost sure they work great, it's just that you did not use them correctly. For linux/mac, I never had any problems converting my PyQt5 apps to C (with Cython), and then compiling them using gcc.
6th Jan 2020, 2:59 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 4
Engin Demir it has nothing to do with python version. Python is compiled directly to C, then to binary. So it will run on systems that don't even have python at all. And yes, it works flawlessly without any problems. About windows, I've seen many tutorials where people convert their codes to .exe, which again will not need python to be installed. Just because you like something, does not mean it is the best to do it. The way I see it, you're the one asking him to switch to C++, and I think it is because you, and many others, dislike python. If you read previous answers, I also told him to use C++ for heavy apps.
6th Jan 2020, 3:21 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 4
Engin Demir I am going to do that. NOTE: If you continue provoking me with things such as "Sadly, internet is now full of people.." and "imaginary world" I will not continue this conversation. Hopefully, we want one of us to correct the perspective of the other, whichever part that is, unless you continue with this behaviour.
6th Jan 2020, 3:35 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 4
Engin Demir being sarcastic and being impolite are two different things. Whatever your intentions were, what you said is definetly considered as provoking, and I'm sure many here would agree. Back to our subject. When you compile it, the dependencies are either compiled with it, or included in the configuration files. So the executable will always be placed along with any dependencies needed, and you can manage that with a setup.py file. Just like you compile C++ along with it dependencies, ans create installers for it, you can do the same for python. After a little research on the internet, I found out that some desktop apps are actually made with python, such as deluge, youtube and bittorrent. And these are pretty popular apps.
6th Jan 2020, 4:08 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 4
My opinion: The absolutely simplest way using Python would be tkinter, because it comes with the package, and the learning curve is flat. If you're okay with the disadvantages, I'd personally go with that in your position, because first learning a completely new language plus a GUI framework will slow you down. 1.) Are you okay with the general look of tkinter programs? Google a bit and take a look at pictures or videos about tkinter, or see if you can find a few tkinter-made programs. 2.) Is Python fast enough to serve your needs? Depends on what exactly you're going to do. Again, looking at existing apps might give you an idea. Or you simply try. 3.) Are you okay with the source code being readable or people needing to download Python to run it? Or are you okay with rather big exe files? Cause you can compile with pyinstaller and others, but the Python runtime has to be crammed into it, so it will take up more space.
6th Jan 2020, 5:00 PM
HonFu
HonFu - avatar
+ 3
Kyrillos Akram 1. It will be a turtle comparing to other languages when you try to do heavy calculations, for a continued period of time. That is a fact. 2. Using C++ for small desktop is not an overkill. It was designed to build both small and big apps. It's a matter of personal preference. 3. Kivy is more oriented towards mobile apps, and from what I read, it is not the best choice.
5th Jan 2020, 7:42 AM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 3
Aymane Boukrouh [INACTIVE] 1. It it will be a turtle for c++ and that's are right but not for you at all if you tried it still very responsive .considering that he not making a 3D game 2. Learning GUI with c++ for just a simple program isn't good idea right time better than run time From the post he already know python so start learning kivy should be easy could take 2 days to create his program It just a commercial thinking way 3.Kivy oriented to be a cross platform GUI framework not for mobile only as you said and this is a advantage , code one time run on any platform
5th Jan 2020, 8:12 AM
Kyrillos Akram
Kyrillos Akram - avatar
+ 3
Python no doubt is much more ahead than all other language and much better because it's has excess of cool library like tkinter which make us to create gui better than by c++
5th Jan 2020, 6:43 PM
Abhishek nirwan
Abhishek nirwan - avatar
+ 3
C++ is great programming language. It makes you well versed with the working of any programming language. It requires knowledge of memory management and also provides object-oriented view. It is a complete package to begin with. Moreover, it is faster than python. CPython is an implementation of python on c. Python 3 is different than CPython. As you mentioned you have a small project. Then I guess you should focus on GUI Design and event management rather than focusing one of the working of a program. For this Python is best. Yes, it is best. PyQT is a binding of Qt(Qt is written in c++). You can modify your GUI with this package. To design your GUI use Qt Designer. Your GUI will be .ui file convert it to .py using PyQT and you can do needful modifications. PS, u can work with Tkinter, but in my experience it is hectic and GUI will not be crisp, it'll be a little blurry. Also, you can work using kivy if your project requires cross-platform operation, and kivy is also cmplx but it does provide designer.
5th Jan 2020, 7:58 PM
Milind Yadav
Milind Yadav - avatar
+ 3
there is also pyGTK, and GTKmm for c++. EDIT : GTK also works with regular C, but GTK is rather hard to compile without pip or some other dependency. Some of the examples for regular C don't work well, but it is possible to make a tic-tac-toe game in either case.
6th Jan 2020, 10:03 AM
Kendrick Mix
Kendrick Mix - avatar
+ 3
Engin Demir kinda wrong, because python now can also be compiled (easily) to one single package to be sent or run as a normal application. It can also be converted to .exe to run on windows.
6th Jan 2020, 2:40 PM
Aymane Boukrouh
Aymane Boukrouh - avatar