自动滚动 PyQT QTextWidget [英] Autoscroll PyQT QTextWidget

查看:46
本文介绍了自动滚动 PyQT QTextWidget的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何自动滚动到我的QTextEdit

在我的 GUI 初始化函数中

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 方法应该这样做.例如:

moveCursor method should do that. e.g.:

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

这篇关于自动滚动 PyQT QTextWidget的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆