Pyqt calling a custom dialog and returning the vars

Marcpp marcpp at gmail.com
Mon Apr 16 16:06:20 EDT 2007


I call a dialog from a principal program but cannot return the value
of the
variables (text box's). Here is a example...



from ui import Agenda
from dialog1 import dialogo1
from PyQt4 import *
import dbm
import sys

class principal (QApplication):

    def __init__(self, args):
        """ In the constructor we're doing everything to get our
application
            started, which is basically constructing a basic
QApplication by
            its __init__ method, then adding our widgets and finally
starting
            the exec_loop."""
        QApplication.__init__(self,args)

        # We pass None since it's the top-level widget, we could in
fact leave
        # that one out, but this way it's easier to add more dialogs
or widgets.
        self.maindialog = ag(None)

        self.setMainWidget(self.maindialog)
        self.maindialog.show()
        self.exec_loop()

class ag (Agenda):
...
...
    def _slotAddClicked(self):
        d=dialogo1()
        d.exec_()
        d.connect(d.buttonOk,SIGNAL("clicked()"),self._procesadialog1)

    def _procesadialog1():
        d=dialogo1()
        drempresa = d.dempresa.text()
        print drempresa  #
<-------------------------------------------------------- Nothing
appears
...
...
if __name__ == "__main__":
    app = principal(sys.argv)




More information about the Python-list mailing list