Python pyqt5! I have a question.

Asked 1 weeks ago, Updated 1 weeks ago, 1 views

There is a pyqt label object called xVal1, which is stored as a string in the variable op_nameA

self.op_name.setText(op_value) An error appears when I try to change the label text like this.

I think it's a type problem, so even if you convert an object to op_name = QLabel(op_name), the object has no attribute error appears Is there a way?

python pyqt5

2022-09-20 15:15

1 Answers

Please check it out

There is a pyqt label object called xVal1

self.xVal1 = QLabel("old Label : ", self)

I saved this as a string in the variable op_nameA

self.op_name = self.xVal1.text()

self.op_name.setText(op_value) I'm trying to change the label text like this, but I get an error.

op_value = 'new Label : '
# # ERROR : self.op_name.setText(op_value)
self.xVal1.setText(op_value )


2022-09-20 15:15

If you have any answers or tips


© 2022 pinfo. All rights reserved.