QPlainTextEdit shows text only if I select the text
Clash Royale CLAN TAG#URR8PPP
QPlainTextEdit shows text only if I select the text
I made a sample program with pyqt5 and python3, but there's a problem.
I appended text into QPlainTextEdit using QPlainTextEdit.appendPlainText, but the text I appended does not appear like there's some glitch in there.
and as soon as I select the whole text, It shows the text correctly.
I want to know if there's some glitch in MacOS pyqt implementation or I am doing exactly wrong thing.
Python 3.6
PyQt5 5.11.2
here's the code:
import sys
from PyQt5.QtWidgets import *
class MainWindow(QMainWindow):
toggle = False
def __init__(self):
super().__init__()
self.setWindowTitle("QMainWindow")
self.setGeometry(300, 300, 300, 400)
btn1 = QPushButton("Click me", self)
btn1.move(20, 20)
btn1.clicked.connect(self.btn1_clicked)
self.textEdit1 = QPlainTextEdit(self)
self.textEdit1.setGeometry(20, 60, 250, 300)
def btn1_clicked(self):
self.toggle = not self.toggle
self.textEdit1.appendPlainText("turned " + ("on" if self.toggle else "off"))
if __name__ == "__main__":
app = QApplication(sys.argv)
mainWindow = MainWindow()
mainWindow.show()
sys.exit(app.exec_())
your code is not complete, and therefore I can not reproduce your problem.
– eyllanesc
Aug 6 at 9:50
okay. I am gonna edit my code in this question right away. tnx for giving me advice.
– Myeongwon Choi
Aug 6 at 9:53
Just to add a little clarity, because you are using .ui files for some of your structure, it is difficult to tell some important properties of your Qt components, and impossible for someone who wants to help to test. You could include the .ui files somehow, but they tend to be big, and most people won't want to dig through them. Best to create a small test that mirrors your intended goal, and post that here if it doesn't work.
– buck54321
Aug 6 at 9:57
@buck54321 I got the point what you're talking about. I am making a tiny sample program that produces the glitch. thanks.
– Myeongwon Choi
Aug 6 at 10:03
By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.
provide a Minimal, Complete, and Verifiable example
– eyllanesc
Aug 6 at 9:50