Sunday, 15 March 2015

windows - Python Qt Designer Button that creates subsequent text entries -


I'm trying to create a GUI in QT Designer which contains a text entry box and a button that is inserted first Another text entry box I probably have to do it more than a dozen times or more

This is my example code from QT Designer: PySide Import from QtCore,

  QtGui class Ui_Dialog (object): def setupUi (self-dialogue): Dialog.setObjectName ( "dialogue") Dialog.resize (247, 300) self.pushButton = QtGui.QPushButton (Dialogue) self.pushButton.setGeometry (QtCore.QRect (110, 10, 75, 23)) self.pushButton.setObjectName ( "pushbutton") self.lineEdit1 = QtGui.QLineEdit (dialogue) self.lineEdit1.setGeometry (QtCore. QRect (20, 10, 31, 20)) self.lineEdit1.setObjectName ( "lineEdit1") self.lineEdit2 = QtGui.QLineEdit (dialogue) self.lineEdit2.setGeometry (QtCore.QRect (60, 10, 31, 20)) self.lineEdit2.setObjectName ( "lineEdit2") self.retranslateUi (dialogue) # QtCore.QObject.connect (self.pushButton, QtCore.SIGNAL ( "Click ()"), Dialog.add_wells) # QtCore.QMetaObject.connectSlotsByName (dialogue ) def retranslateUi (self-interaction): Dialog.setWindowTitle (QtGui.QApplicatio n.translate ( "communicate", "communication", no, QtGui.QApplication.UnicodeUTF8)) self.pushButton.setText (QtGui.QApplication.translate ( "Dialog", "push button", none, QtGui.QApplication.Unic odeUTF8))  

And it's code to run GUI:

  PySide.QtGui * Imports System Imports addentryexample from * PySide.QtCore import import Class MainWindow (QDialog, addentryexample.Ui_Dialog): def __init __ (self, parent = none): Super (MainWindow, Self) .__ init __ (parent) self.setupUi (self) self.connect (self.pushButton, Sign ("click"), self.add_entry) def add_entry (auto): pass ap = QApplication (sys.argv) form = main window () form.show () app.exec_ ()  

How do I repeat every name of the text box entry I am struggling but I I can choose later values. I think they just need to add a certain amount for each 'set gemetry' feature.

Any help would be appreciated!

you findChildren :

  lineEdits = Edit form.findChildren (QLineEdit) line edit for line: Print Line Edit.objectName ()  

No comments:

Post a Comment