I try to print variables in QTextEdit in a continuous form and not to print each value in a new line in PyQt5. I use the code below to print values:
for i in myDict.keys():
L = len(myDict[i])
if L >= 5:
self.ui.valueText.append(str(i))
the output of this code is like this:
1
2
3
...
But i want to print them in one line and if i reach the end of Text edit, wrap the text and print them in new line. I want this output:
1,2,3,4,5.....
51,52, ....
I appreciate any answer on this problem.
CodePudding user response:
You should at first take the text of current QTextEdit and then append it with new value and then print it:
for i in myDict.keys():
L = len(myDict[i])
if L >= 5:
x= self.ui.valueText.toPlainText()
self.ui.valueText.setText(x "(" str(i) "," str(L) ") ,")