Autoscroll PyQT QTextWidget

后端 未结 3 922
慢半拍i
慢半拍i 2021-02-05 18:15

How can I autoscroll to the bottom of my QTextEdit

in my GUI init function

self.mytext = QTextEdit()
self.cursor = QTextCur         


        
相关标签:
3条回答
  • 2021-02-05 18:33

    moveCursor method should do that. e.g.:

    self.mytext.moveCursor(QtGui.QTextCursor.End)
    
    0 讨论(0)
  • 2021-02-05 18:35
    self.mytext.ensureCursorVisible()
    
    0 讨论(0)
  • 2021-02-05 18:48

    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!

    0 讨论(0)
提交回复
热议问题