The first question is, why do we even need to write GUI applications using Python? The simple answer can be in situations where you need to get some input data from the user or show the results as charts or diagrams or some use cases similar to these.
To implement a GUI application using Python, we have two main approaches to take:
Desktop Application: Use a framework or library like Tkinter, PyQt, Kivy, or wxPython that shows GUI elements on the screen like a native application.
Web Application: Write a local web application using Python and serve it on a local port. Then, write a frontend for that using JavaScript and its friends.
Each approach has its pros and cons, and I tried to summarize them in the following table:
As the table shows, implementing a local web application has many advantages over writing a desktop application. However, we need to implement the backend and front end, which will increase the development time and cost, and we also need to write the front end in another language (JavaScript).
The local web application approach also applies to other programming languages, such as Go or Rust, which don’t support desktop application development well.
What do you think? If you have any experience with these approaches, please share your views as a comment.
You can also support me in buying a latte ☕️ !(one time or monthly):