[PyKDE] how to pass Qt.WFlags?

Gerard Vermeulen gerard.vermeulen at grenoble.cnrs.fr
Sun Mar 12 21:52:57 GMT 2006


Phil,

this program:

#!/usr/bin/env python

import sys
import PyQt4.Qt as Qt

class MyMainWindow(Qt.QMainWindow):
    def __init__(self):
        print type(Qt.Qt.WA_QuitOnClose)
        # this type must be an alias for a WFlags, isn't it??
        Qt.QMainWindow.__init__(self, None, Qt.Qt.WA_QuitOnClose)

if __name__ == '__main__':
    app = Qt.QApplication(sys.argv)
    demo = MyMainWindow()
    demo.show()

raises this exception:

$ python bug.py
<class 'PyQt4.QtCore.WidgetAttribute'>
Traceback (most recent call last):
  File "bug.py", line 14, in ?
    demo = MyMainWindow()
  File "bug.py", line 10, in __init__
    Qt.QMainWindow.__init__(self, None, Qt.Qt.WA_QuitOnClose)
TypeError: argument 2 of QMainWindow() has an invalid type

Am I doing something wrong?

Gerard




More information about the PyQt mailing list