gpt4 book ai didi

python - 自动滚动 PyQT QTextWidget

转载 作者:太空狗 更新时间:2023-10-29 17:55:58 25 4
gpt4 key购买 nike

我如何自动滚动到我的QTextEdit

的底部

在我的 GUI 初始化函数中

self.mytext = QTextEdit()
self.cursor = QTextCursor(self.mytext.document())
self.mytext.setTextCursor(self.cursor)

以及我如何在另一个函数中添加它

self.cursor.insertText(str(self.user) + ": " + str(self.line.text()) + "\n")

最佳答案

moveCursor方法应该这样做。例如:

self.mytext.moveCursor(QtGui.QTextCursor.End)

关于python - 自动滚动 PyQT QTextWidget,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7778726/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com