How can I connect Qcombobox with Qlineedit to import data from xml file ?

Python und das Qt-Toolkit, erstellen von GUIs mittels des Qt-Designers.
Antworten
Momo123
User
Beiträge: 7
Registriert: Donnerstag 20. Juni 2019, 13:57

Sonntag 7. Juli 2019, 09:34

import xml.etree.ElementTree as et
from PyQt5 import QtCore, QtGui, QtWidgets

class Ui_TabWidget_Walls(object):

def changeText(self):

base_path = os.path.dirname(os.path.realpath(__file__))
xml_file = os.path.join(base_path, "Data\\MaterialTemplates_v4.xml")
tree = et.parse(xml_file)
root = tree.getroot()

for child in root:

if (child.tag.split("}")[1]) == "Material":

for children in child:
if (children.tag.split("}")[1]) == "density":
d = children.text
self.lineEdit_18.setText(d)


def Data(self):

base_path = os.path.dirname(os.path.realpath(__file__))
xml_file = os.path.join(base_path, "Data\\MaterialTemplates_v4.xml")

tree = et.parse(xml_file)
root = tree.getroot()

for child in root:

if (child.tag.split("}")[1]) == "Material":

for children in child:
# print (children.tag)

if (children.tag.split("}")[1]) == "name":
n = children.text
print(n)
if (children.tag.split("}")[1]) == "density":
d = children.text
print(d)

self.comboBox_Wall1.addItem(n)
# self.lineEdit_18.setText(d)

self.comboBox_Wall1.activated['QString'].connect(self.changeText)
QtCore.QMetaObject.connectSlotsByName(TabWidget_Walls)

def setupUi(self, TabWidget_Walls):
TabWidget_Walls.setObjectName("TabWidget_Walls")
TabWidget_Walls.resize(494, 493)
TabWidget_Walls.setTabShape(QtWidgets.QTabWidget.Triangular)
self.tab = QtWidgets.QWidget()
self.tab.setObjectName("tab")
self.gridLayout_2 = QtWidgets.QGridLayout(self.tab)
self.gridLayout_2.setObjectName("gridLayout_2")
self.label_14 = QtWidgets.QLabel(self.tab)
self.label_14.setObjectName("label_14")
self.gridLayout_2.addWidget(self.label_14, 7, 0, 1, 1)
self.label_16 = QtWidgets.QLabel(self.tab)
self.label_16.setObjectName("label_16")
self.gridLayout_2.addWidget(self.label_16, 9, 0, 1, 1)
self.lineEdit_17 = QtWidgets.QLineEdit(self.tab)
self.lineEdit_17.setObjectName("lineEdit_17")
self.gridLayout_2.addWidget(self.lineEdit_17, 7, 1, 1, 1)
self.label_18 = QtWidgets.QLabel(self.tab)
self.label_18.setObjectName("label_18")
self.gridLayout_2.addWidget(self.label_18, 8, 0, 1, 1)
self.lineEdit_13 = QtWidgets.QLineEdit(self.tab)
self.lineEdit_13.setText("")
self.lineEdit_13.setObjectName("lineEdit_13")
self.gridLayout_2.addWidget(self.lineEdit_13, 8, 1, 1, 1)
self.lineEdit_14 = QtWidgets.QLineEdit(self.tab)
self.lineEdit_14.setObjectName("lineEdit_14")
self.gridLayout_2.addWidget(self.lineEdit_14, 9, 1, 1, 1)
self.pushButton_Wall1 = QtWidgets.QPushButton(self.tab)
self.pushButton_Wall1.setObjectName("pushButton_Wall1")

self.pushButton_Wall1.clicked.connect(self.Data)

self.gridLayout_2.addWidget(self.pushButton_Wall1, 0, 1, 1, 1)
self.comboBox_Wall1 = QtWidgets.QComboBox(self.tab)
self.comboBox_Wall1.setObjectName("comboBox_Wall1")
self.comboBox_Wall1.addItem("")
self.gridLayout_2.addWidget(self.comboBox_Wall1, 1, 1, 1, 1)
self.lineEdit_18 = QtWidgets.QLineEdit(self.tab)
self.lineEdit_18.setObjectName("lineEdit_18")
self.gridLayout_2.addWidget(self.lineEdit_18, 10, 1, 1, 1)
self.label_13 = QtWidgets.QLabel(self.tab)
self.label_13.setObjectName("label_13")
self.gridLayout_2.addWidget(self.label_13, 11, 0, 1, 1)
self.lineEdit_16 = QtWidgets.QLineEdit(self.tab)
self.lineEdit_16.setObjectName("lineEdit_16")
self.gridLayout_2.addWidget(self.lineEdit_16, 11, 1, 1, 1)
self.label_15 = QtWidgets.QLabel(self.tab)
self.label_15.setObjectName("label_15")
self.gridLayout_2.addWidget(self.label_15, 12, 0, 1, 1)
self.label_17 = QtWidgets.QLabel(self.tab)
self.label_17.setObjectName("label_17")
self.gridLayout_2.addWidget(self.label_17, 10, 0, 1, 1)
self.buttonBox = QtWidgets.QDialogButtonBox(self.tab)
self.buttonBox.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox.setObjectName("buttonBox")
self.gridLayout_2.addWidget(self.buttonBox, 13, 0, 1, 2)
self.lineEdit_15 = QtWidgets.QLineEdit(self.tab)
self.lineEdit_15.setObjectName("lineEdit_15")
self.gridLayout_2.addWidget(self.lineEdit_15, 12, 1, 1, 1)
self.label_25 = QtWidgets.QLabel(self.tab)
self.label_25.setObjectName("label_25")
self.gridLayout_2.addWidget(self.label_25, 0, 0, 3, 1)
self.lineEdit = QtWidgets.QLineEdit(self.tab)
self.lineEdit.setObjectName("lineEdit")
self.gridLayout_2.addWidget(self.lineEdit, 2, 1, 1, 1)
TabWidget_Walls.addTab(self.tab, "")
self.tab1 = QtWidgets.QWidget()
self.tab1.setObjectName("tab1")
self.gridLayout_3 = QtWidgets.QGridLayout(self.tab1)
self.gridLayout_3.setObjectName("gridLayout_3")
self.buttonBox_2 = QtWidgets.QDialogButtonBox(self.tab1)
self.buttonBox_2.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox_2.setObjectName("buttonBox_2")
self.gridLayout_3.addWidget(self.buttonBox_2, 9, 0, 1, 2)
self.pushButton_Wall2 = QtWidgets.QPushButton(self.tab1)
self.pushButton_Wall2.setObjectName("pushButton_Wall2")
self.gridLayout_3.addWidget(self.pushButton_Wall2, 0, 1, 1, 1)
self.comboBox_Wall1_3 = QtWidgets.QComboBox(self.tab1)
self.comboBox_Wall1_3.setObjectName("comboBox_Wall1_3")
self.comboBox_Wall1_3.addItem("")
self.gridLayout_3.addWidget(self.comboBox_Wall1_3, 1, 1, 1, 1)
self.label_44 = QtWidgets.QLabel(self.tab1)
self.label_44.setObjectName("label_44")
self.gridLayout_3.addWidget(self.label_44, 3, 0, 1, 1)
self.lineEdit_40 = QtWidgets.QLineEdit(self.tab1)
self.lineEdit_40.setText("")
self.lineEdit_40.setObjectName("lineEdit_40")
self.gridLayout_3.addWidget(self.lineEdit_40, 4, 1, 1, 1)
self.label_42 = QtWidgets.QLabel(self.tab1)
self.label_42.setObjectName("label_42")
self.gridLayout_3.addWidget(self.label_42, 4, 0, 1, 1)
self.lineEdit_38 = QtWidgets.QLineEdit(self.tab1)
self.lineEdit_38.setObjectName("lineEdit_38")
self.gridLayout_3.addWidget(self.lineEdit_38, 3, 1, 1, 1)
self.lineEdit_42 = QtWidgets.QLineEdit(self.tab1)
self.lineEdit_42.setObjectName("lineEdit_42")
self.gridLayout_3.addWidget(self.lineEdit_42, 5, 1, 1, 1)
self.label_46 = QtWidgets.QLabel(self.tab1)
self.label_46.setObjectName("label_46")
self.gridLayout_3.addWidget(self.label_46, 6, 0, 1, 1)
self.label_45 = QtWidgets.QLabel(self.tab1)
self.label_45.setObjectName("label_45")
self.gridLayout_3.addWidget(self.label_45, 7, 0, 1, 1)
self.lineEdit_41 = QtWidgets.QLineEdit(self.tab1)
self.lineEdit_41.setObjectName("lineEdit_41")
self.gridLayout_3.addWidget(self.lineEdit_41, 6, 1, 1, 1)
self.label_43 = QtWidgets.QLabel(self.tab1)
self.label_43.setObjectName("label_43")
self.gridLayout_3.addWidget(self.label_43, 5, 0, 1, 1)
self.lineEdit_37 = QtWidgets.QLineEdit(self.tab1)
self.lineEdit_37.setObjectName("lineEdit_37")
self.gridLayout_3.addWidget(self.lineEdit_37, 7, 1, 1, 1)
self.lineEdit_39 = QtWidgets.QLineEdit(self.tab1)
self.lineEdit_39.setObjectName("lineEdit_39")
self.gridLayout_3.addWidget(self.lineEdit_39, 8, 1, 1, 1)
self.label_41 = QtWidgets.QLabel(self.tab1)
self.label_41.setObjectName("label_41")
self.gridLayout_3.addWidget(self.label_41, 8, 0, 1, 1)
self.lineEdit_2 = QtWidgets.QLineEdit(self.tab1)
self.lineEdit_2.setObjectName("lineEdit_2")
self.gridLayout_3.addWidget(self.lineEdit_2, 2, 1, 1, 1)
self.label_47 = QtWidgets.QLabel(self.tab1)
self.label_47.setObjectName("label_47")
self.gridLayout_3.addWidget(self.label_47, 0, 0, 3, 1)
TabWidget_Walls.addTab(self.tab1, "")
self.tab_4 = QtWidgets.QWidget()
self.tab_4.setObjectName("tab_4")
self.gridLayout = QtWidgets.QGridLayout(self.tab_4)
self.gridLayout.setObjectName("gridLayout")
self.lineEdit_32 = QtWidgets.QLineEdit(self.tab_4)
self.lineEdit_32.setObjectName("lineEdit_32")
self.gridLayout.addWidget(self.lineEdit_32, 3, 1, 1, 1)
self.label_36 = QtWidgets.QLabel(self.tab_4)
self.label_36.setObjectName("label_36")
self.gridLayout.addWidget(self.label_36, 3, 0, 1, 1)
self.label_34 = QtWidgets.QLabel(self.tab_4)
self.label_34.setObjectName("label_34")
self.gridLayout.addWidget(self.label_34, 4, 0, 1, 1)
self.label_38 = QtWidgets.QLabel(self.tab_4)
self.label_38.setObjectName("label_38")
self.gridLayout.addWidget(self.label_38, 6, 0, 1, 1)
self.comboBox_Wall1_4 = QtWidgets.QComboBox(self.tab_4)
self.comboBox_Wall1_4.setObjectName("comboBox_Wall1_4")
self.comboBox_Wall1_4.addItem("")
self.gridLayout.addWidget(self.comboBox_Wall1_4, 1, 1, 1, 1)
self.pushButton_Wall3 = QtWidgets.QPushButton(self.tab_4)
self.pushButton_Wall3.setObjectName("pushButton_Wall3")
self.gridLayout.addWidget(self.pushButton_Wall3, 0, 1, 1, 1)
self.lineEdit_34 = QtWidgets.QLineEdit(self.tab_4)
self.lineEdit_34.setText("")
self.lineEdit_34.setObjectName("lineEdit_34")
self.gridLayout.addWidget(self.lineEdit_34, 4, 1, 1, 1)
self.lineEdit_36 = QtWidgets.QLineEdit(self.tab_4)
self.lineEdit_36.setObjectName("lineEdit_36")
self.gridLayout.addWidget(self.lineEdit_36, 5, 1, 1, 1)
self.lineEdit_31 = QtWidgets.QLineEdit(self.tab_4)
self.lineEdit_31.setObjectName("lineEdit_31")
self.gridLayout.addWidget(self.lineEdit_31, 7, 1, 1, 1)
self.label_37 = QtWidgets.QLabel(self.tab_4)
self.label_37.setObjectName("label_37")
self.gridLayout.addWidget(self.label_37, 7, 0, 1, 1)
self.label_35 = QtWidgets.QLabel(self.tab_4)
self.label_35.setObjectName("label_35")
self.gridLayout.addWidget(self.label_35, 5, 0, 1, 1)
self.lineEdit_33 = QtWidgets.QLineEdit(self.tab_4)
self.lineEdit_33.setObjectName("lineEdit_33")
self.gridLayout.addWidget(self.lineEdit_33, 8, 1, 1, 1)
self.lineEdit_35 = QtWidgets.QLineEdit(self.tab_4)
self.lineEdit_35.setObjectName("lineEdit_35")
self.gridLayout.addWidget(self.lineEdit_35, 6, 1, 1, 1)
self.buttonBox_3 = QtWidgets.QDialogButtonBox(self.tab_4)
self.buttonBox_3.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox_3.setObjectName("buttonBox_3")
self.gridLayout.addWidget(self.buttonBox_3, 9, 0, 1, 2)
self.label_33 = QtWidgets.QLabel(self.tab_4)
self.label_33.setObjectName("label_33")
self.gridLayout.addWidget(self.label_33, 8, 0, 1, 1)
self.lineEdit_3 = QtWidgets.QLineEdit(self.tab_4)
self.lineEdit_3.setText("")
self.lineEdit_3.setObjectName("lineEdit_3")
self.gridLayout.addWidget(self.lineEdit_3, 2, 1, 1, 1)
self.label_39 = QtWidgets.QLabel(self.tab_4)
self.label_39.setObjectName("label_39")
self.gridLayout.addWidget(self.label_39, 0, 0, 3, 1)
TabWidget_Walls.addTab(self.tab_4, "")
self.tab_5 = QtWidgets.QWidget()
self.tab_5.setObjectName("tab_5")
self.gridLayout_4 = QtWidgets.QGridLayout(self.tab_5)
self.gridLayout_4.setObjectName("gridLayout_4")
self.pushButton_Wall4_2 = QtWidgets.QPushButton(self.tab_5)
self.pushButton_Wall4_2.setObjectName("pushButton_Wall4_2")
self.gridLayout_4.addWidget(self.pushButton_Wall4_2, 0, 1, 1, 1)
self.label_22 = QtWidgets.QLabel(self.tab_5)
self.label_22.setObjectName("label_22")
self.gridLayout_4.addWidget(self.label_22, 3, 0, 1, 1)
self.comboBox_Wall1_5 = QtWidgets.QComboBox(self.tab_5)
self.comboBox_Wall1_5.setObjectName("comboBox_Wall1_5")
self.comboBox_Wall1_5.addItem("")
self.gridLayout_4.addWidget(self.comboBox_Wall1_5, 1, 1, 1, 1)
self.label_20 = QtWidgets.QLabel(self.tab_5)
self.label_20.setObjectName("label_20")
self.gridLayout_4.addWidget(self.label_20, 4, 0, 1, 1)
self.label_21 = QtWidgets.QLabel(self.tab_5)
self.label_21.setObjectName("label_21")
self.gridLayout_4.addWidget(self.label_21, 5, 0, 1, 1)
self.lineEdit_24 = QtWidgets.QLineEdit(self.tab_5)
self.lineEdit_24.setObjectName("lineEdit_24")
self.gridLayout_4.addWidget(self.lineEdit_24, 5, 1, 1, 1)
self.lineEdit_22 = QtWidgets.QLineEdit(self.tab_5)
self.lineEdit_22.setText("")
self.lineEdit_22.setObjectName("lineEdit_22")
self.gridLayout_4.addWidget(self.lineEdit_22, 4, 1, 1, 1)
self.lineEdit_20 = QtWidgets.QLineEdit(self.tab_5)
self.lineEdit_20.setObjectName("lineEdit_20")
self.gridLayout_4.addWidget(self.lineEdit_20, 3, 1, 1, 1)
self.label_23 = QtWidgets.QLabel(self.tab_5)
self.label_23.setObjectName("label_23")
self.gridLayout_4.addWidget(self.label_23, 7, 0, 1, 1)
self.label_19 = QtWidgets.QLabel(self.tab_5)
self.label_19.setObjectName("label_19")
self.gridLayout_4.addWidget(self.label_19, 8, 0, 1, 1)
self.label_24 = QtWidgets.QLabel(self.tab_5)
self.label_24.setObjectName("label_24")
self.gridLayout_4.addWidget(self.label_24, 6, 0, 1, 1)
self.lineEdit_23 = QtWidgets.QLineEdit(self.tab_5)
self.lineEdit_23.setObjectName("lineEdit_23")
self.gridLayout_4.addWidget(self.lineEdit_23, 6, 1, 1, 1)
self.lineEdit_19 = QtWidgets.QLineEdit(self.tab_5)
self.lineEdit_19.setObjectName("lineEdit_19")
self.gridLayout_4.addWidget(self.lineEdit_19, 7, 1, 1, 1)
self.buttonBox_4 = QtWidgets.QDialogButtonBox(self.tab_5)
self.buttonBox_4.setStandardButtons(QtWidgets.QDialogButtonBox.Cancel|QtWidgets.QDialogButtonBox.Ok)
self.buttonBox_4.setObjectName("buttonBox_4")
self.gridLayout_4.addWidget(self.buttonBox_4, 9, 0, 1, 2)
self.lineEdit_21 = QtWidgets.QLineEdit(self.tab_5)
self.lineEdit_21.setObjectName("lineEdit_21")
self.gridLayout_4.addWidget(self.lineEdit_21, 8, 1, 1, 1)
self.lineEdit_4 = QtWidgets.QLineEdit(self.tab_5)
self.lineEdit_4.setText("")
self.lineEdit_4.setObjectName("lineEdit_4")
self.gridLayout_4.addWidget(self.lineEdit_4, 2, 1, 1, 1)
self.label_40 = QtWidgets.QLabel(self.tab_5)
self.label_40.setObjectName("label_40")
self.gridLayout_4.addWidget(self.label_40, 0, 0, 3, 1)
TabWidget_Walls.addTab(self.tab_5, "")

self.retranslateUi(TabWidget_Walls)
TabWidget_Walls.setCurrentIndex(0)


def retranslateUi(self, TabWidget_Walls):
_translate = QtCore.QCoreApplication.translate
TabWidget_Walls.setWindowTitle(_translate("TabWidget_Walls", "EnergyADE"))
self.label_14.setText(_translate("TabWidget_Walls", "Area"))
self.label_16.setText(_translate("TabWidget_Walls", "U-Value"))
self.lineEdit_17.setPlaceholderText(_translate("TabWidget_Walls", "m²"))
self.label_18.setText(_translate("TabWidget_Walls", "Thickness"))
self.lineEdit_13.setPlaceholderText(_translate("TabWidget_Walls", "m"))
self.lineEdit_14.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m²)"))
self.pushButton_Wall1.setText(_translate("TabWidget_Walls", "click on to choose from catalog"))
self.comboBox_Wall1.setItemText(0, _translate("TabWidget_Walls", "other"))
self.lineEdit_18.setPlaceholderText(_translate("TabWidget_Walls", "kg/m³"))
self.label_13.setText(_translate("TabWidget_Walls", "Conductivity"))
self.lineEdit_16.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m)"))
self.label_15.setText(_translate("TabWidget_Walls", "Heat Capacity"))
self.label_17.setText(_translate("TabWidget_Walls", "Density"))
self.lineEdit_15.setPlaceholderText(_translate("TabWidget_Walls", "J/K"))
self.label_25.setText(_translate("TabWidget_Walls", "Material Name"))
self.lineEdit.setPlaceholderText(_translate("TabWidget_Walls", "name"))
TabWidget_Walls.setTabText(TabWidget_Walls.indexOf(self.tab), _translate("TabWidget_Walls", "Wall 1"))
self.pushButton_Wall2.setText(_translate("TabWidget_Walls", "click on to choose from catalog"))
self.comboBox_Wall1_3.setItemText(0, _translate("TabWidget_Walls", "other"))
self.label_44.setText(_translate("TabWidget_Walls", "Area"))
self.lineEdit_40.setPlaceholderText(_translate("TabWidget_Walls", "m"))
self.label_42.setText(_translate("TabWidget_Walls", "Thickness"))
self.lineEdit_38.setPlaceholderText(_translate("TabWidget_Walls", "m²"))
self.lineEdit_42.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m²)"))
self.label_46.setText(_translate("TabWidget_Walls", "Density"))
self.label_45.setText(_translate("TabWidget_Walls", "Conductivity"))
self.lineEdit_41.setPlaceholderText(_translate("TabWidget_Walls", "kg/m³"))
self.label_43.setText(_translate("TabWidget_Walls", "U-Value"))
self.lineEdit_37.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m)"))
self.lineEdit_39.setPlaceholderText(_translate("TabWidget_Walls", "J/K"))
self.label_41.setText(_translate("TabWidget_Walls", "Heat Capacity"))
self.lineEdit_2.setPlaceholderText(_translate("TabWidget_Walls", "name"))
self.label_47.setText(_translate("TabWidget_Walls", "Material Name"))
TabWidget_Walls.setTabText(TabWidget_Walls.indexOf(self.tab1), _translate("TabWidget_Walls", "Wall 2"))
self.lineEdit_32.setPlaceholderText(_translate("TabWidget_Walls", "m²"))
self.label_36.setText(_translate("TabWidget_Walls", "Area"))
self.label_34.setText(_translate("TabWidget_Walls", "Thickness"))
self.label_38.setText(_translate("TabWidget_Walls", "Density"))
self.comboBox_Wall1_4.setItemText(0, _translate("TabWidget_Walls", "other"))
self.pushButton_Wall3.setText(_translate("TabWidget_Walls", "click on to choose from catalog"))
self.lineEdit_34.setPlaceholderText(_translate("TabWidget_Walls", "m"))
self.lineEdit_36.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m²)"))
self.lineEdit_31.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m)"))
self.label_37.setText(_translate("TabWidget_Walls", "Conductivity"))
self.label_35.setText(_translate("TabWidget_Walls", "U-Value"))
self.lineEdit_33.setPlaceholderText(_translate("TabWidget_Walls", "J/K"))
self.lineEdit_35.setPlaceholderText(_translate("TabWidget_Walls", "kg/m³"))
self.label_33.setText(_translate("TabWidget_Walls", "Heat Capacity"))
self.lineEdit_3.setPlaceholderText(_translate("TabWidget_Walls", "name"))
self.label_39.setText(_translate("TabWidget_Walls", "Material Name"))
TabWidget_Walls.setTabText(TabWidget_Walls.indexOf(self.tab_4), _translate("TabWidget_Walls", "Wall 3"))
self.pushButton_Wall4_2.setText(_translate("TabWidget_Walls", "click on to choose from catalog"))
self.label_22.setText(_translate("TabWidget_Walls", "Area"))
self.comboBox_Wall1_5.setItemText(0, _translate("TabWidget_Walls", "other"))
self.label_20.setText(_translate("TabWidget_Walls", "Thickness"))
self.label_21.setText(_translate("TabWidget_Walls", "U-Value"))
self.lineEdit_24.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m²)"))
self.lineEdit_22.setPlaceholderText(_translate("TabWidget_Walls", "m"))
self.lineEdit_20.setPlaceholderText(_translate("TabWidget_Walls", "m²"))
self.label_23.setText(_translate("TabWidget_Walls", "Conductivity"))
self.label_19.setText(_translate("TabWidget_Walls", "Heat Capacity"))
self.label_24.setText(_translate("TabWidget_Walls", "Density"))
self.lineEdit_23.setPlaceholderText(_translate("TabWidget_Walls", "kg/m³"))
self.lineEdit_19.setPlaceholderText(_translate("TabWidget_Walls", "W/(K*m)"))
self.lineEdit_21.setPlaceholderText(_translate("TabWidget_Walls", "J/K"))
self.lineEdit_4.setPlaceholderText(_translate("TabWidget_Walls", "name"))
self.label_40.setText(_translate("TabWidget_Walls", "Material Name"))
TabWidget_Walls.setTabText(TabWidget_Walls.indexOf(self.tab_5), _translate("TabWidget_Walls", "Wall 4"))

if name == "main":
import sys
app = QtWidgets.QApplication(sys.argv)
TabWidget_Walls = QtWidgets.QTabWidget()
ui = Ui_TabWidget_Walls()
ui.setupUi(TabWidget_Walls)
TabWidget_Walls.show()
sys.exit(app.exec_())
__deets__
User
Beiträge: 5782
Registriert: Mittwoch 14. Oktober 2015, 14:29

Sonntag 7. Juli 2019, 09:54

Es ist dir schon mal gesagt worden: benutz die code Tags, damit man den Code lesen kann. Und immer und immer die gleiche Frage stellen, ohne auf die Antworten die man schon bekommen hat einzugehen - das wird nichts.
Benutzeravatar
__blackjack__
User
Beiträge: 3524
Registriert: Samstag 2. Juni 2018, 10:21

Sonntag 7. Juli 2019, 09:57

@Momo123: Haven't you asked this question already in this topic: QCombobox und QLineedit?

The answers are still the same: Please put the code into code tags so we can see the indentation.

Don't use generated UI code. And if you use it anyway, then definitely don't change the generated file but inherit from the UI class in another module like shown in the PyQt documentation.

You are missing an important step: Reading the XML and creating a Python data structure from it. For instance a dictionary that maps material names to their properties. Perhaps in the form of a `collections.namedtuple()`.

The next thing that needs attention are the attribute names of the UI components. `lineEdit_18` is a *really* bad name for a line edit that contains the density of a material.
A train station is where trains stop.
A bus station is where busses stop.
A Work Station is where …
Antworten