Home > Back-end >  Python GUI to run python script without opening the IDE
Python GUI to run python script without opening the IDE

Time:09-23

Is there any quick way- library or an example- to create a simple GUI by python in order to run any python script separately? so that it is not necessary to have to open the python IDE or not to have it installed.

For example a simple window with "add the script path" and an "execute" button.

CodePudding user response:

You could use tkinter - it is a pretty simple GUI library.

As for the backend, you could either import the other script (not recommended, as it will basically run the script, and could be malicious) or do something like:

# from https://stackoverflow.com/questions/1186789/what-is-the-best-way-to-call-a-script-from-another-script
exec(open("file.py").read())

You could also use subprocess or os.system to call python.

  • Related