Home > other >  How pyqt5 QTextEdit scroll bar in the automatic roll to the bottom
How pyqt5 QTextEdit scroll bar in the automatic roll to the bottom

Time:11-19

As title, each time to manually set down the scroll bar to see the latest information, very trouble, can automatically scroll down

CodePudding user response:

CodePudding user response:

CodePudding user response:

Does anyone know??????

CodePudding user response:

Void QTextEdit: : scrollToBottom ()
Scroll to the bottom of the text
Try this one

CodePudding user response:

Through pyqt4 experiment, 5 should also can use,

 

SHOW2STR="'
Def initUI (self) :
Self. Text_show2=QtGui. QTextEdit ()
Self. Text_show2. SetText (SHOW2STR)
Self. Text_show2. SetReadOnly (True)
Self. Text_hex=QtGui. QTextEdit ()
Self. Text_hex. SetText (HEXSTR)
Self. Text_hex. SetReadOnly (True)
Self. Save_but=QtGui. QPushButton (u 'PDF' self)
Self. Save_but. SetCheckable (False)
Self. Save_but. Clicked. Connect (self. Save_pdf)
Vbox=QtGui. QVBoxLayout ()
Vbox. AddWidget (self. Text_show2)
Vbox. AddWidget (self. Text_hex)
Vbox. AddWidget (self. Save_but)
Self. SetLayout (Vbox)
The last line
"'

The import OS
The import sys

Sys. Path. Append (OS) path) dirname (OS) path) abspath (__file__)))
The from PyQt4 import QtGui, QtCore


The class Example (QtGui. QWidget) :
Def __init__ (self) :
Super (Example, self) __init__ ()
The self. The initUI ()

Def initUI (self) :
Self. Text_show2=QtGui. QTextEdit ()
Self. Text_show2. SetText (SHOW2STR)
Cursor=self. Text_show2. TextCursor ()
Pos=len (self) text_show2) toPlainText ())
Cursor. SetPosition (pos - 1)
Self. Text_show2. EnsureCursorVisible ()
Self. Text_show2. SetTextCursor (cursor)
Self. Save_but=QtGui. QPushButton (u 'Test', the self)
Self. Save_but. SetCheckable (False)
# self. Save_but. Clicked. Connect (self. Save_pdf)
Vbox=QtGui. QVBoxLayout ()
Vbox. AddWidget (self. Text_show2)
Vbox. AddWidget (self. Save_but)
Self. SetLayout (Vbox)
The self. The show ()


App=QtGui. QApplication (sys. Argv)
The ex=Example ()
Sys. Exit (app. Exec_ ())

CodePudding user response:

reference 5 floor old coconut reply:
by pyqt4 experiment, 5 should also can use,

 

SHOW2STR="'
Def initUI (self) :
Self. Text_show2=QtGui. QTextEdit ()
Self. Text_show2. SetText (SHOW2STR)
Self. Text_show2. SetReadOnly (True)
Self. Text_hex=QtGui. QTextEdit ()
Self. Text_hex. SetText (HEXSTR)
Self. Text_hex. SetReadOnly (True)
Self. Save_but=QtGui. QPushButton (u 'PDF' self)
Self. Save_but. SetCheckable (False)
Self. Save_but. Clicked. Connect (self. Save_pdf)
Vbox=QtGui. QVBoxLayout ()
Vbox. AddWidget (self. Text_show2)
Vbox. AddWidget (self. Text_hex)
Vbox. AddWidget (self. Save_but)
Self. SetLayout (Vbox)
The last line
"'

The import OS
The import sys

Sys. Path. Append (OS) path) dirname (OS) path) abspath (__file__)))
The from PyQt4 import QtGui, QtCore


The class Example (QtGui. QWidget) :
Def __init__ (self) :
Super (Example, self) __init__ ()
The self. The initUI ()

Def initUI (self) :
Self. Text_show2=QtGui. QTextEdit ()
Self. Text_show2. SetText (SHOW2STR)
Cursor=self. Text_show2. TextCursor ()
Pos=len (self) text_show2) toPlainText ())
Cursor. SetPosition (pos - 1)
Self. Text_show2. EnsureCursorVisible ()
Self. Text_show2. SetTextCursor (cursor)
Self. Save_but=QtGui. QPushButton (u 'Test', the self)
Self. Save_but. SetCheckable (False)
# self. Save_but. Clicked. Connect (self. Save_pdf)
Vbox=QtGui. QVBoxLayout ()
Vbox. AddWidget (self. Text_show2)
Vbox. AddWidget (self. Save_but)
Self. SetLayout (Vbox)
The self. The show ()


App=QtGui. QApplication (sys. Argv)
The ex=Example ()
Sys. Exit (app. Exec_ ())

CodePudding user response:

I met a new problem now is that the content is not in the textEdit updated once a execute a command, but after the completion of all time to write, how to solve this problem?

CodePudding user response:

Thread asynchronous
  • Related