-2

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?

my_list = []
a = QLineEdit()
a.setText("text1")
my_list.append(a)

b = QLineEdit()
b.setText("text2")
my_list.append(b)
Johan
  • 863
  • 3
  • 13
  • 28
  • Why downvote? Please explain. – Johan Jan 26 '17 at 10:58
  • I feel the downvote was done because the answer to the question can be found quite easily. More info - https://meta.stackexchange.com/help/how-to-ask – shad0w_wa1k3r Jan 26 '17 at 13:27
  • Which button do you want to get the text from? – eyllanesc Jan 26 '17 at 18:06
  • @Ashish Nitin Patil please provide a link to a source which does this. The PyQt documentation and wiki - files that I looked at were long and as a beginner it is hard to know where to find the answer. – Johan Jan 27 '17 at 08:56

1 Answers1

0

Getting result from element with idx i:

answer = my_list[i].text()
avtomaton
  • 4,725
  • 1
  • 38
  • 42
Johan
  • 863
  • 3
  • 13
  • 28