On 07/10/13 19:07, Jens Persson wrote:
This example runs without errors for me on Python2 in Linux.

ok, i should say these errors are occurring with pyqt5,1, qt5.1 python 3.3 on 64bit linux.


Greets Jens

On Mon, Oct 7, 2013 at 2:27 AM, Stephen Gava <elgua...@gmail.com
<mailto:elgua...@gmail.com>> wrote:


    Phil, i've attached a simple test case that illustrates this
    problem, here it is inline:

    import sys

    from PyQt5.QtWidgets import (QApplication,QMainWindow)

    class MainWindow(QMainWindow):
         def __init__(self):
             super(MainWindow,self).__init____()
             self.setWindowTitle('test case')
             top_level_window=self.window()
             print(top_level_window)

    gui_app=QApplication(sys.argv)
    gui_main_window=MainWindow()
    gui_main_window.show()
    sys.exit(gui_app.exec_())

    the result of running the above is an exception:

    builtins.AttributeError: 'MainWindow' object has no attribute 'QWidget'

    with the traceback stopping in my code at the line where i try to
    use the result of self.window() (by simply printing it).

    if you comment out the print(top_level_window) the code runs fine so
    the error happens when trying to _use_ the result of self.window()
    in any way.

    obviously MainWindow is already a top level window, so in the more
    complex code where i'm getting these kind of errors the call to
    QWindow.window() is ocurring in widget (sub)classes that belong to
    the MainWindow.

    as i said this error crops up in several places, but seemingly after
    calls to either QWidget.window() or QWidget.childAt() in my code.
    i'm hoping you find some general cause for this, but if you need it
    i'll try to also come up with a simple case where it's triggered
    after the childAt() call.

    thanks,
    stephen.

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to