Python Forum
[PyQt] How to clear multiple Qlineedit in a loop
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyQt] How to clear multiple Qlineedit in a loop
#2
This is done when during creation
MyLineEditDict[key] = self.txtNamePerson
Then when you need to do something to them all you just do this
for key in MyLineEditDict.keys()
    MyLineEditDict[key].setText('None for All')
Note: key is whatever you want it to be since how it is being used means there is no need to care what it is, however, if you want to handle your LineEdits a bit more semi-sequential or perhaps more intuitively you could make it a numeric index of some sort. Regardless the basics of this would not change any just its particulars.
Reply


Messages In This Thread
RE: How to clear multiple Qlineedit in a loop - by Denni - Aug-09-2019, 01:14 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [PyQt] QLineEdit Caret (Text Cursor) Transparency malonn 5 2,926 Nov-04-2022, 09:04 PM
Last Post: malonn
  How to accept only float number in QLineEdit input ism 5 28,694 Jul-06-2021, 05:23 PM
Last Post: deanhystad
  Simple printing the text for a QLineEdit thewolf 16 8,093 Mar-06-2021, 11:37 PM
Last Post: deanhystad
  PyQt5: How to retrieve a QLineEdit by its name ? arbiel 4 8,024 Oct-21-2020, 02:35 PM
Last Post: arbiel
  Two QlineEdit box, which interrelated GMCobraz 1 2,460 Aug-14-2020, 07:15 PM
Last Post: deanhystad
  [PyQt] Dynamically add and remove QLineEdit's GMCobraz 3 7,241 Jun-23-2020, 07:01 PM
Last Post: Yoriz
  prompt for input in qlineedit GMCobraz 3 3,263 Jun-22-2020, 01:51 PM
Last Post: GMCobraz
  [PyQt] display content from left to right in QComboBox or QLineEdit mart79 2 2,365 May-30-2020, 04:38 PM
Last Post: Axel_Erfurt
  How to loop through all QLineEdit widgets on a form JayCee 6 6,792 Apr-03-2020, 12:15 AM
Last Post: JayCee
  How to validate multiple QLineEdit widgets without addressing them separately? mart79 3 4,315 Aug-08-2019, 12:50 PM
Last Post: Denni

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020