Answer the question
In order to leave comments, you need to log in
How to use text in label?
I'm currently learning pyqt5 and want to do something like a list. Now I am faced with the problem that I need the program to define the text in the label, and if it is there, then write it in another designated place.
I tried
tte = ui.label.setText()
But didn't help.
Answer the question
In order to leave comments, you need to log in
Well, look.
To get the text contained in the label, you need to write
self.название_вашего_лейбла_в_форме.text()
Respectively Take it and check for emptiness
if len(self.название_вашего_лейбла_в_форме.text()) != 0: #т.е. если есть хоть один символ в тексте лейбла
self.название_вашего_лейбла_в_форме.setText("Текст,который вы хотите присвоить в другую метку")
tte = ui.label.setText()
The text should just change or on clicking on something?
P.S. Try
tte = ui.label.setText("Тут текст")
ui.label.repaint()
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question