问题
I now how to set value(number) but can i read that label in some variable. if can't read, in which similar widgets can i put value and read it. Any help would be halpful or someone has an other idea. Maybe like LCD number, spin box
回答1:
Like this?
QString text = someLabel->text();
回答2:
Here is the documentation. QLabel.text()
EDIT:
QString text = theLabel.text();
//or with pointer
QString text = theLabel->text();
回答3:
have you tried :
QString s = YourQLabel->text();
This should work, I guess.
回答4:
// Thelepaty mode on
You need to use editor widgets, for example QLineEdit or QTextEdit. You may customize it via QSS to look like a QLabel.
P.S. try to improve your English. It is hard to understand, what you are asking.
// Thelepaty mode off
来源:https://stackoverflow.com/questions/59912392/how-do-you-get-the-current-value-of-a-qtlabel-in-python-pyqt5