tkinter - How to make a Python script run without it opening the console window? -
i want double click on python script (which uses tkinter gui) , want open tkinter window, not console window.
to this, changed extension .py .pyw , seems work fine on windows when double click .pyw file on linux machine, doesn't work. froze , had restart system.
please suggest platform-independent solution me run python script without opening terminal/command prompt.
you can use pyinstaller
create executables different platforms want.
for example,
the syntax of pyinstaller command is:
pyinstaller [options] script [script ...] | specfile
in simple case, set current directory location of program myscript.py , execute:
pyinstaller myscript.py
pyinstaller analyzes myscript.py and:
writes myscript.spec in same folder script. creates folder build in same folder script if not exist. writes log files , working files in build folder. creates folder dist in same folder script if not exist. writes myscript executable folder in dist folder.
in dist folder find bundled app distribute users.
normally name 1 script on command line. if name more, analyzed , included in output. however, first script named supplies name spec file , executable folder or file. code first execute @ run-time.
for uses may edit contents of myscript.spec (described under using spec files). after this, name spec file pyinstaller instead of script:
pyinstaller myscript.spec
you may give path script or spec file, example
pyinstaller options... ~/myproject/source/myscript.py
or, on windows,
pyinstaller "c:\documents , settings\project\myscript.spec"
Comments
Post a Comment