I like to use Wingware’s IDE for coding in Python. I am working through some sample applications with Kivy, a cross-platform Python GUI framework that can also create UIs for mobile. Anyway, getting Kivy set up in Wing is slightly confusing, so here’s a crash course:
- Download Kivy
- Unzip Kivy somewhere. In my case, I unzipped it here: C:\kivy1.7.2\
- Run kivy.bat which is in the directory you unzipped to. You should see something like the following
Now we’re ready to open up Wing. Once you have that open, start a new project. Then go to the Project menu and choose the Project Properties option, which is at the very bottom of the list. You should see something like the following:
Set the Python Executable option to your Kivy’s Python, which in my case was: c:\kivy1.7.2\Python\python.exe
Set the Python Path to C:\kivy1.7.2\kivy (or modify to match where you extracted Kivy to).
At this point, you should be able to import kivy in your environment, but you won’t be able to actually execute your kivy scripts. To get past that, you need to go to the bottom section of the Project Properties dialog and change the Environment setting drop-down to Add to inherited environment. Finally, you’ll want to copy the PATH information from the kivy.bat screen that you saw above into the textbox below the Environment setting. In my case, it looked something like this:
PATH=C:\kivy1.7.2\;C:\kivy1.7.2\Python;C:\kivy1.7.2\Python\Scripts;C:\kivy1.7.2\gstreamer\bin;C:\kivy1.7.2\MinGW\bin;C:\Python26\Lib\site-packages\PyQt4;C:\Python27\Lib\site-packages\PyQt4;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static;C:\Program Files (x86)\Intel\Services\IPT\;C:\Program Files (x86)\IBM\Client Access\Emulator;C:\Program Files (x86)\IBM\Client Access\Shared;C:\Program Files (x86)\IBM\Client Access\;C:\Python26;C:\Python26\Scripts;C:\Program Files\TortoiseSVN\bin;C:\Program Files\SlikSvn\bin;C:\Program Files (x86)\Calibre2\;C:\Program Files (x86)\QuickTime\QTSystem\;C:\Program Files (x86)\GNU\GnuPG\pub;C:\Windows\Microsoft.NET\Framework64\v4.0.30319;C:\PROGRA~1\IBM\SQLLIB\BIN;C:\PROGRA~1\IBM\SQLLIB\FUNCTION;C:\Program Files (x86)\Git\cmd;C:\Program Files (x86)\Mercurial;C:\MinGW\bin
Except that it should all be on one line. Otherwise Wing will complain that each variable must be be in a var=value pair. Once you’ve got all this done, you can run a kivy script from within Wing. This circumvents the need to drag a Python file onto kivy.bat to run a kivy program.