Pyqt calling a custom dialog and returning the vars
Marcpp
marcpp at gmail.com
Tue Apr 17 13:52:03 EDT 2007
On 17 abr, 00:03, "Diez B. Roggisch" <d... at nospam.web.de> wrote:
> Marcpp schrieb:
>
>
>
> > 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)
>
> Shouldn't you connect the signal _before_ the dialog is shown?
>
> > def _procesadialog1():
> > d=dialogo1()
> > drempresa = d.dempresa.text()
> > print drempresa #
> > <-------------------------------------------------------- Nothing
> > appears
> > ...
> > ...
> > if __name__ == "__main__":
> > app = principal(sys.argv)
>
> Diez
How I'll do it?
More information about the Python-list
mailing list