Finally got GTK+ working in NetBeans 6.5 (Python EA)

I easily managed get this to work on Windows XP but when I installed it on Windows Vista the python debugger ( JPyDbg ) wouldn’t find gtk. From within NetBeans I created a project which simply did the following;

import sys
print sys.path
import gtk

The import wouldn’t work and sys.path showed that the ‘gtk’ libs were not in the PYTHONPATH.  I have no idea why NetBeans hasn’t picked up the correct path since PYTHONPATH does have ‘gtk’ libs in it when running Python from the command line.

The solution?  From the NetBeans menus select “Tools->Python Platforms”.  Then from the dialogue box that pops up select “Python 2.5.4” or similar and “Python Path”.  Add the missing path which in my case was “c:\Python25\Lib\site-packages\gtk-2.0”

Dialogue box for PythonPath

Dialogue box for PythonPath


Best Python IDE … found :)

I’ve looked around at a few IDE’s for Python and I think I’ve settled on one.  Initially I considered Eclipse but I’ve now decided that NetBeans 6.5.1 is a much better solution for Linux (or Windows) Python development.

Installing it was easy.  I downloaded the C/C++ version of the IDE (since I didn’t plan to do any Java based stuff).  It is just over 20Mb at the NetBeans website.  Note: I did C/C++ then Python but you can simply download the IDE with Python from the Python EA (Easy Access) page.

In Thunar (on the Linpus) right-click on the Netbeans ‘.sh’ file, select properties and then permissions and chose to ‘allow file to run as a program’. Double click on the file to run it and the installation process begins.  Just click ‘Next’ in most cases.

After installing it; use the right-click menu (assuming you have it active) to run the IDE from the development area.  Once started, mine started to upgrade some modules for CVS, and so on (which is okay).  After the obligatory restart of the IDE, I simply used the Plugins menu in Tools to add Python support.  This is a Beta state module.

All is well? Unfortunately not; I tried to create a new project and this hung the IDE part way through creating files.  I tried NetBeans 6.5 Python EA on Windows Vista also and this worked a little better.  However, it wouldn’t pick up the gtk module in the debugger, even though IDLE did.  So still some problems but maybe you will have better luck.

Update: I did a fress install of the Netbeans Python EA after installing Python, GTK, Cairo & GObject and this appears to work in the debugger.

Nevertheless, there is a really useful tutorial on the NetBeans site.

I’ve also stumbled upon this amazing selection of programming tutorials!  In particular using Python development in NetBeans.   Replace ‘import glib’ in these tutorials with ‘import gobject’ throughout these tutorials.

Another alternative is the ActivePython IDE

%d bloggers like this: