Python Forum
Find active PyQT5 textline and add result to dictionary
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Find active PyQT5 textline and add result to dictionary
#4
None-runable example of what I mean -- this works by the way if put into a window of some sort.

self.TextLine1 = QLineEdit()
self.TextLine2 = QLineEdit()

self.TxtLineDict = {}
self.TxtLineDict[1] = self.TextLine1
self.TxtLineDict[2] = self.TextLine2

self.TxtLineDict[2].setText('Setting Text in Line Edit 2')
Note: I chose numbers to use as keys but you can use anything to use as a key based off of what makes most sense for whatever you are striving to achieve -- this just makes referencing numerous like objects generically a lot easier

And again this is just one way to accomplish what you described but it is not the only way I am sure.
Reply


Messages In This Thread
RE: Find active PyQT5 textline and add result to dictionary - by Denni - Jul-31-2019, 03:25 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] Background inactivity timer when tkinter window is not active DBox 4 2,911 Apr-16-2022, 04:04 PM
Last Post: DBox
  [Tkinter] how can disable menu [About] when Toplevel is active balenaucigasa 0 2,658 Oct-25-2019, 09:49 PM
Last Post: balenaucigasa
  Active tkinter text output during loop dvanommen 2 10,753 Oct-18-2019, 02:23 PM
Last Post: dvanommen
  [PyQt] Collect entry from textline Widget via UI file mart79 3 2,891 Aug-05-2019, 01:40 PM
Last Post: Denni
  Huge code problems (buttons(PyQt5),PyQt5 Threads, Windows etc) ZenWoR 0 2,814 Apr-06-2019, 11:15 PM
Last Post: ZenWoR
  PyQt5: Add Variable Number of Rows to Layout Based on Python Dictionary kennybassett 2 4,746 Oct-02-2018, 02:05 PM
Last Post: Alfalfa

Forum Jump:

User Panel Messages

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