All,
At the moment I have about 30 QLineEdit widgets on my GUI. The snippet only shows 3. Do I need to address them all individually or is there something which is more efficient?
At the moment I have about 30 QLineEdit widgets on my GUI. The snippet only shows 3. Do I need to address them all individually or is there something which is more efficient?
from PyQt5 import QtCore, QtGui, QtWidgets
from propertyDialog5 import Ui_Dialog
from PyQt5.QtWidgets import QApplication, QTreeWidget, QTreeWidgetItem, QComboBox
from PyQt5.QtCore import pyqtSlot
from PyQt5.QtCore import QRegExp
from PyQt5.QtGui import QRegExpValidator
import numpy as np
[python]class mainProgram(QtWidgets.QMainWindow, Ui_Dialog):
def __init__(self, parent=None):
self.cntPipe = 0
self.pipeproperty = {}
self.joint_weight = 0
self.weight_pipe = 0
self.weight_liner = 0
self.weight_coating = 0
self.pipe = 0
self.specific_gravity = 9.81
self.total_coating_weight = 0
self.total_liner_weight = 0
self.txtAbsorptionType.addItems(['Mass','Volume'])
self.txtAbsorptionType.setCurrentIndex(0)
self.AbsorptionType = 'Mass'
super(mainProgram, self).__init__(parent)
self.setupUi(self)
regex = QRegExp ("[0-9._]+")
validator = QRegExpValidator(regex)
self.txtPipeOuterDiameter.setValidator(validator)
self.txtPipeInnerDiameter.setValidator(validator)
self.txtPipeDensity.setValidator(validator)
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
nextGui = mainProgram()
nextGui.show()
sys.exit(app.exec_())
