RkBlog

Hardware, programming and astronomy tutorials and reviews.

PySide 1.0.3 is working nicely

Some time ago initial PySide releases wasn't able to run apps written with PyQt4 "just like that" with only few changes to the code. I've tested current 1.0.3 release with my quite simple App - "Zbrojownia Albionu"

Some time ago initial PySide releases wasn't able to run apps written with PyQt4 "just like that" with only few changes to the code. I've tested current 1.0.3 release with my quite simple App - "Zbrojownia Albionu" and I've managed to get it working with PySide quickly.

PySide is a Python library for Qt4 released under LGPL license. PyQt4 is released as GPL or paid commercial license. The more libre LGPL license is in the scope of interest for some closed source apps.

I've started from changing the imports:
from PySide import QtCore, QtGui
Parent constructor also needed changing from:
class MyForm(QtGui.QMainWindow):
	def __init__(self, parent=None):
		QtGui.QWidget.__init__(self, parent)
To:
class MyForm(QtGui.QMainWindow):
	def __init__(self, parent=None):
		QtGui.QMainWindow.__init__(self, parent)
I had to remove setMargin as QGridLayout doesn't seems to have it in PySide:
self.ui.centralwidget.layout().setMargin(0)
After that my app was working, although it did spawn few warning like:
TypeError: 'PySide.QtGui.QCheckBox.setCheckState' called with wrong argument types:
  PySide.QtGui.QCheckBox.setCheckState(int)
Supported signatures:
  PySide.QtGui.QCheckBox.setCheckState(PySide.QtCore.Qt.CheckState)

The app was simple, but it looks like PySide is or it will be quite quickly a complete, stable and in general compatible with PyQt4 library for Qt apps development in Python.

RkBlog

4 June 2011;

Comment article