So i want add GUI in to my script as i already created .exe file of my script and it will take simple file-path from user and and write it into my database. My code of taking input:
filename = input("Input the Filename: ")
dfs = pd.read_excel(filename, usecols=['SR_NO','NTN'], sheet_name=None)
Is there any way that when i run script a gui can pop up and take file path as input and pass it to my script
CodePudding user response:
If you only need something simple, you can use Tkinter (it's already built-in in Python) and its askopenfile function.
More information about the usage can be found here: https://docs.python.org/3/library/dialog.html#tkinter.filedialog.askopenfile
And here are a few examples on how to use this: https://www.pythontutorial.net/tkinter/tkinter-open-file-dialog/
CodePudding user response:
You can use Tkinter, PyQt and Kivy to build a GUI app. Although Tkinter is simple, it is not as beautiful as PyQt.
Note that: PyQt and PySide are very similar. you can learn more from here.
PyQt - PyQt is a set of Python bindings for The Qt Company's Qt application framework and runs on all platforms supported by Qt including Windows, macOS, Linux, iOS and Android.
Kivy - Open source Python library for rapid development of applications that make use of innovative user interfaces, such as multi-touch apps.
Tkinter - The tkinter package (“Tk interface”) is the standard Python interface to the Tcl/Tk GUI toolkit. Both Tk and tkinter are available on most Unix platforms, including macOS, as well as on Windows systems
