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

List:       pykde
Subject:    Re: [PyQt] RE: Can I create more than one instance of a class?
From:       "Chris M" <chris.pm () gmail ! com>
Date:       2008-06-19 17:42:18
Message-ID: e5dbe5a50806191042h2f816776n84bcb9365df16389 () mail ! gmail ! com
[Download RAW message or body]

Adonay,

Glad to hear you have solved the issue :-D

The problem you give of the window disappearing or not appearing at
all is because the variable 'other' (or a,b,c) goes out of scope when
the _init_ method returns. You need to keep a reference to the window
object (which your new code does by using the global windowList). You
could also have defined the object as 'self.other' which would have
the same effect (although without a window list).

Regards,
Chris.

2008/6/19 adonay@k-demar.org <adonay@k-demar.org>:
> 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(R) Exchange technology -
> http://link.mail2web.com/LIVE
>
>
>
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
>

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt
[prev in list] [next in list] [prev in thread] [next in thread] 

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