[PyQt] PyQt4 flags processing

Hans-Peter Jansen hpj at urpla.net
Wed Sep 29 10:11:41 BST 2010


Hi Phil,

I believe, that code like this ought to run correctly:

from PyQt4 import QtCore, QtGui

class Widget(QtGui.QWidget):
    def __init__(self, parent = None, flags = 0):
        super(Widget, self).__init__(parent, flags)

app = QtGui.QApplication([])
win = Widget()
win.show()
app.exec_()

Now it results in:

[...]
>>> win = Widget()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 3, in __init__
TypeError: QWidget(QWidget parent=None, Qt.WindowFlags flags=0): 
argument 2 has unexpected type 'int'

Do we really need wrap the flags argument with 
QtCore.Qt.WindowFlags(flags) to make this work correctly?

Pete

Python version: 2.6
sip version: 4.11.1
Qt4 version: 4.6.3
PyQt4 version: 4.7.7


More information about the PyQt mailing list