[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyKDE] how to pass Qt.WFlags?
From:       Phil Thompson <phil () riverbankcomputing ! co ! uk>
Date:       2006-03-13 22:10:09
Message-ID: 200603132210.09292.phil () riverbankcomputing ! co ! uk
[Download RAW message or body]

On Sunday 12 March 2006 9:52 pm, Gerard Vermeulen wrote:
> 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?

They are of different types. WA_QuitOnClose is an WidgetAttribute enum. Use 
QWidget.setAttribute() to set it.

Phil

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic