Reputation: 8211
Currently I'm using a batch
file like the following one for starting a python
application on windows.
@echo off
pushd ..
call .venv\Scripts\activate.bat
set PYTHONPATH=%cd%
python -tt src/myapp.py
This activates the virtualenv
and then launches the application. This is not very elegant since it opens a CMD
-window and I can't do an application icon.
What's a better way to do this to make it more like a single application?
Upvotes: 1
Views: 1017
Reputation: 7974
If you are satisfied with a really simple solution, try something like this:
Create a file "start_my_app.vbs" (it is Visual Basic Script) with the following code:
Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "pythonw.exe my_app.py"
Set objShell = Nothing
Just update the code above for whatever you need to run (virtualenv etc.) before your python file. However, you cannot change the icon of vbs file. But when you create a shortcut to this vbs file, then you can change the icon of the shortcut very easily (right click - Properties - Change icon...).
Upvotes: 1