Делаю дизайн PyQt:
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'test.ui'
#
# Created by: PyQt5 UI code generator 5.15.0
#
# WARNING: Any manual changes made to this file will be lost when pyuic5 is
# run again. Do not edit this file unless you know what you are doing.
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Form(object):
def setupUi(self, Form):
Form.setObjectName("Form")
Form.resize(118, 100)
self.comboBox = QtWidgets.QComboBox(Form)
self.comboBox.setGeometry(QtCore.QRect(10, 60, 101, 32))
self.comboBox.setObjectName("comboBox")
self.comboBox.addItem("")
self.label = QtWidgets.QLabel(Form)
self.label.setGeometry(QtCore.QRect(10, -20, 121, 100))
self.label.setObjectName("label")
self.retranslateUi(Form)
self.comboBox.editTextChanged['QString'].connect(Form.text)
QtCore.QMetaObject.connectSlotsByName(Form)
def retranslateUi(self, Form):
_translate = QtCore.QCoreApplication.translate
Form.setWindowTitle(_translate("Form", "Form"))
self.comboBox.setItemText(0, _translate("Form", "Admin For"))
self.label.setText(_translate("Form", "Виберіть режим"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
Form = QtWidgets.QWidget()
###########################################
def text():
print(QString.editTextChanged)
###########################################
ui = Ui_Form()
ui.setupUi(Form)
Form.show()
sys.exit(app.exec_())
Ошибка:
Traceback (most recent call last):
File "/Users/polina/Desktop/VS_NOTES_VERSIOn_6.2/test.py", line 51, in <module>
ui.setupUi(Form)
File "/Users/polina/Desktop/VS_NOTES_VERSIOn_6.2/test.py", line 27, in setupUi
self.comboBox.editTextChanged['QString'].connect(Form.text)
AttributeError: 'QWidget' object has no attribute 'text'
Что делать?