[PyQt] RE: Can I create more than one instance of a class?

adonay at k-demar.org adonay at k-demar.org
Thu Jun 19 14:29:03 BST 2008


Finally using your code, the a b c window disappears!
I have read a example of SDI window and now it works. If you are interested
in, the code is like this.

Parent program (main.py)

class main(QMainWindow):
    windowList=[]
    def __init__(self):
        QMainWindow.__init__(self)
        uic.loadUi("ui/main.ui", self)
        from new_window import newwindow
        other = newwindow()
        main.windowList.append(other)
        other.show()



Important code here is "main.windowList.append(other)" if you remove this
line, child (other) never exists and never appears.


Child window (new_window.py) 

class newwindow(QWidget):
    def __init__(self):
        QWidget.__init__(self)
        uic.loadUi("ui/newwindow.ui", self)



Tnx,

Adonay Sanz
www.k-demar.org

--------------------------------------------------------------------
mail2web LIVE – Free email based on Microsoft® Exchange technology -
http://link.mail2web.com/LIVE





More information about the PyQt mailing list