Reputation: 139
I have a simple script that calls other scripts and works fine:
def demandesparbranche():
os.system('python Sources/x.py')
def demandesparlogiciel():
os.system('python Sources/xx.py')
def demandeshcapprouvees():
os.system('python Sources/xxx.py')
def challengesreussis():
os.system('python Sources/xxxx.py')
My idea was to add a GUI with tkinter and freeze this code (with pyinstaller) and use it as a set of buttons to launch the scripts that would in this way remain modifiable. I tried and it does not work, which is logical since in a computer without python installed the command 'python' is obviously unknown. The code works fine in my computer where python is installed.
Is this in any way possible using possibly another form of script calling? What I mean is: how to call the Python interpreter frozen by pyinstaller instead of a system one?
Upvotes: 4
Views: 442
Reputation: 139
So, I found the solution:
Instead of calling the script with the 'os' module I imported the needed scripts :
from xscript import x
And called it directly via button:
tk.Button(mainframe, width=25, text="Something", command=x, bg='light grey')\
.grid(column=1, row=1, sticky=W)
2 caveats:
A file name init.py is needed in the same directory; same for the scripts imported.
Upvotes: 1