I'm building a GUI using Python 2.7, Matplotlib version 1.2.1, QT4 4.9.6. The goal is to be able to load images, rescale them, and perform other small manipulations. Since I'm porting the GUI from a MATLAB script it made sense to use Matplotlib, with all the similar commands and whatnot.
Since there isn't a standard matplotlib traits editor so far as I can tell, I've used this article to help build the editor. Everything works just fine in Spyder 2.2.0, but in Eclipse I get an 18-item traceback (last few lines copied here):
File "C:\Python27\lib\site-packages\traitsui\qt4\ui_panel.py", line 572, in __init__
layout = self._add_items(content, inner)
File "C:\Python27\lib\site-packages\traitsui\qt4\ui_panel.py", line 909, in _add_items
self._set_item_size_policy(editor, item, label, stretch)
File "C:\Python27\lib\site-packages\traitsui\qt4\ui_panel.py", line 1002, in _set_item_size_policy
is_item_resizable, is_item_springy, stretch)
File "C:\Python27\lib\site-packages\traitsui\qt4\editor.py", line 388, in set_size_policy
policy.setHorizontalPolicy(QtGui.QSizePolicy.Expanding)
TypeError: QSizePolicy.setHorizontalPolicy(QSizePolicy.Policy): argument 1 has unexpected type 'PySide.QtGui.QSizePolicy.Policy'
In Spyder I have the "QT-Python bindings library" set to PySide. Does anyone have an idea about why there'd be a conflict in Eclipse but not in Spyder? Thanks!
Figured this out, all it needed was to set an environmental default (found this by looking through the Spyder startup script and checking what it was doing that I wasn't doing in Eclipse):
os.environ.setdefault('QT_API','pyside')