[英]How to get string inside QLineEdit (PyQt5 and Python)?
I was looking for an answer to this beginner question but only found long or complicated ones.我一直在寻找这个初学者问题的答案,但只找到了冗长或复杂的答案。 I have a list of QLineEdits and now I want to get the string in one of them, how is this done?我有一个 QLineEdits 列表,现在我想在其中一个中获取字符串,这是如何完成的?
my_list = []
a = QLineEdit()
a.setText("text1")
my_list.append(a)
b = QLineEdit()
b.setText("text2")
my_list.append(b)
从带有 idx i
元素获取结果:
answer = my_list[i].text()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.