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

List:       pykde
Subject:    [PyQT] Linking two custom widgets
From:       Joaquín_Llovet_Martínez
Date:       2009-07-29 11:10:55
Message-ID: 2b97c4c70907290410p38c267e7yfc1c8b545e1c47c1 () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,
I searched arround google and this mailing too and I did not find info about
doing this specific question.

I have Main.py that calls Ui_ventanaPrincipal, where through a pushbutton I
want to connect another custom widget called Ui_crearAlumno, the signal of
ventanaPrincipal that connects Ui_crearAlumno is the next:
QtCore.QObject.connect(self.pushButtoncrearAlumno,
QtCore.SIGNAL("clicked()"), ventanaPrincipal.linkeacreaAlumno)

Main.py:
class ventanaPrincipal(QtGui.QWidget):
    def __init__(self):
        QtGui.QWidget.__init__(self)
        self.ventana = Ui_ventanaPrincipal()
        self.ventana.setupUi(self)

    def linkeacreaAlumno(self):
        class crearAlumno(QtGui.QWidget):
            def __init__(self):
                QtGui.QWidget.__init__(self)
                self.ventana2 = Ui_crearAlumno()
                self.ventana2.setupUi(self)
            def guardarDatos(self):
                return
        #app = QtGui.QApplication(sys.argv)
        ventana2 = crearAlumno()
        ventana2.show()
        sys.exit(app.exec_())


    def linkeaadministraAlumnos(self):
       return
    def linkeaEstadisticas(self):
        return
    def linkeaRecibos(self):
        return

def main():
    app = QtGui.QApplication(sys.argv)
    ventana = ventanaPrincipal()
    ventana.show()
    sys.exit(app.exec_())

if __name__ == "__main__":
    main()

I have tried almost everything and it functions with errors. What do I have
to do to fix the problem at def linkeacreaAlumno(self)?

Thank you.

[Attachment #5 (text/html)]

Hi,<br>I searched arround google and this mailing too and I did not find info about \
doing this specific question.<br><br>I have Main.py that calls Ui_ventanaPrincipal, \
where through a pushbutton I want to connect another custom widget called \
Ui_crearAlumno, the signal of ventanaPrincipal that connects  Ui_crearAlumno is the \
next: QtCore.QObject.connect(self.pushButtoncrearAlumno, \
QtCore.SIGNAL(&quot;clicked()&quot;), ventanaPrincipal.linkeacreaAlumno)<br> \
<br>Main.py:<br>class ventanaPrincipal(QtGui.QWidget):<br>    def __init__(self):<br> \
QtGui.QWidget.__init__(self)<br>        self.ventana = Ui_ventanaPrincipal()<br>      \
self.ventana.setupUi(self)<br>        <br>  def linkeacreaAlumno(self):<br>        \
class crearAlumno(QtGui.QWidget):<br>            def __init__(self):<br>              \
QtGui.QWidget.__init__(self)<br>                self.ventana2 = Ui_crearAlumno()<br>  \
self.ventana2.setupUi(self)<br>  def guardarDatos(self):<br>                \
return<br>        #app = QtGui.QApplication(sys.argv)<br>        ventana2 = \
crearAlumno()<br>        ventana2.show()<br>        sys.exit(app.exec_())<br><br><br> \
def linkeaadministraAlumnos(self):<br>  return<br>    def \
linkeaEstadisticas(self):<br>        return<br>    def linkeaRecibos(self):<br>       \
return<br><br>def main():<br>    app = QtGui.QApplication(sys.argv)<br>    ventana = \
ventanaPrincipal()<br>    ventana.show()<br>  sys.exit(app.exec_())<br><br>if \
__name__ == &quot;__main__&quot;:<br>    main()<br><br>I have tried almost everything \
and it functions with errors. What do I have to do to fix the problem at def \
linkeacreaAlumno(self)?<br> <br>Thank you.<br>


["Main.py" (application/octet-stream)]

_______________________________________________
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