How can I autoscroll to the bottom of my QTextEdit
in my GUI init function
self.mytext = QTextEdit()
self.cursor = QTextCursor(self.mytext.document())
self.mytext.setTextCursor(self.cursor)
and how I am adding to it in another function
self.cursor.insertText(str(self.user) + ": " + str(self.line.text()) + "\n")
moveCursor
method should do that. e.g.:
self.mytext.moveCursor(QtGui.QTextCursor.End)
I've found the following to work:
from PyQt4 import QtGui
self.display = QtGui.QTextBrowser()
self.display.verticalScrollBar().setValue(
self.display.verticalScrollBar().maximum())
Good luck!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With