How do I add a gui to a python code

Navyoscar45

Regular Member
Joined
Nov 13, 2018
Messages
435
Reaction score
94
Imagine I have written a whole code that runs through command line, please how can I add a gui to it
E.g
Print("enter your name")
x = input()
print("hello, " + x)

Please how can I add gui without altering the main code
 
You can look into tkinter but depending on what the function does, you might need to modify it.
 
Imagine I have written a whole code that runs through command line, please how can I add a gui to it
E.g
Print("enter your name")
x = input()
print("hello, " + x)

Please how can I add gui without altering the main code
You can try tutorialspoint.com for video of that
 
Tkinter,kivy there are many bindings for python just gsearch
 
Is it possible to make A GUI without having to changing the main code
 
Actually no, because your code needs to look different when used in (for example) Tkinter.
 
Use PyQt. Best free option, works on linux as well. I can make a video tutorial on it during the weekend, as most videos dont cover an important aspect.

Pip install pyqt5 pyqt5-tools

Designer in cmd to open the gui creator.

Gl, let us know if u need more info.
 
Creating a GUI application using Tkinter is an easy task. All you need to do is perform the following steps −

  • Import the Tkinter module.

  • Create the GUI application main window.

  • Add one or more of the above-mentioned widgets to the GUI application.

  • Enter the main event loop to take action against each event triggered by the user.
 
As someone who has written and sold a commercial app written in python and pyqt, I'd like to comment.

No, you cannot add a GUI without modifying your code.

How much it would have to be modified would depend on how it was written. If you plan on adding a GUI at some point, it's always good to structure your code with that thought in mind.

In the future though, if you are planning to develop more desktop apps, I would stay away from python altogether.

There is no good bundling method for python apps. They can be hard to distribute without further modification. Nothing ever goes smoothly when bundling a python app unless it's an extremely simple app.

I have been using angular + electron for desktop apps lately, and would highly recommend the combination. Things tend to go smoothly, and when they don't, there is an abundant amount of information on stack overflow concerning electron.

I'm looking forward to when flutter for desktop is finally stable for all platforms and has good plugin support. That will be a great day for desktop development.
 
Back
Top