python - How can i validate and exit QInputDialog? -


... textbox = qtgui.qinputdialog.gettext(self, 'get name',              'enter  name:')         text =texbox[0] textbox2 = qtgui.qinputdialog.gettext(self, 'get surname',              'enter  surname:')         text2 =texbox2[0] ... 

i using python 3.3 pyqt4. when making gui, asking user enter specific details using multiple popup dialog boxes within function, when nothing entered box accept such value, instead of asking user reenter. there option close dialog box (the exit button in top right), when clicked next dialog box run instead of stop entire function. want dialog boxes stop running when exit button activated, , dialog box not allow no vlaues being entered. if other information needed please let me know.

use form gathering information. can have dialog code below. code might not need, sure point right direction.

enter image description here

here code (generated using qtdesigner pyuic4)

note: automatically generated internationalization's stuff removed making example briefest.

from pyqt4 import qtcore, qtgui  class ui_dialog(object):     def setupui(self, dialog):         dialog.setobjectname("dialog")         dialog.resize(371, 113)         self.gridlayout_2 = qtgui.qgridlayout(dialog)         self.gridlayout_2.setobjectname("gridlayout_2")         self.gridlayout = qtgui.qgridlayout()         self.gridlayout.setobjectname("gridlayout")         self.label = qtgui.qlabel(dialog)         self.label.setobjectname("label")         self.gridlayout.addwidget(self.label, 0, 0, 1, 1)         self.lineedit = qtgui.qlineedit(dialog)         self.lineedit.setobjectname("lineedit")         self.gridlayout.addwidget(self.lineedit, 0, 1, 1, 1)         self.label_2 = qtgui.qlabel(dialog)         self.label_2.setobjectname("label_2")         self.gridlayout.addwidget(self.label_2, 1, 0, 1, 1)         self.lineedit_2 = qtgui.qlineedit(dialog)         self.lineedit_2.setobjectname("lineedit_2")         self.gridlayout.addwidget(self.lineedit_2, 1, 1, 1, 1)         self.gridlayout_2.addlayout(self.gridlayout, 0, 0, 1, 1)         self.buttonbox = qtgui.qdialogbuttonbox(dialog)         self.buttonbox.setorientation(qtcore.qt.horizontal)         self.buttonbox.setstandardbuttons(qtgui.qdialogbuttonbox.cancel|qtgui.qdialogbuttonbox.ok)         self.buttonbox.setobjectname("buttonbox")         self.gridlayout_2.addwidget(self.buttonbox, 1, 0, 1, 1)          qtcore.qobject.connect(self.buttonbox, qtcore.signal("accepted()"), dialog.accept)         qtcore.qobject.connect(self.buttonbox, qtcore.signal("rejected()"), dialog.reject)         qtcore.qmetaobject.connectslotsbyname(dialog)  if __name__ == "__main__":     import sys     app = qtgui.qapplication(sys.argv)     dialog = qtgui.qdialog()     ui = ui_dialog()     ui.setupui(dialog)     dialog.show()     sys.exit(app.exec_()) 

Comments

Popular posts from this blog

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

ruby on rails - Seeing duplicate requests handled with Unicorn -