[英]Tkinter - Canvas Text Object Auto-Scroll
I'm working on a Tkinter application with a Canvas
and a create_text
object drawn on top of this Canvas
. 我正在Tkinter应用程序上使用Canvas
和在此Canvas
上绘制的create_text
对象。
This text object word wraps automatically through the width
property. 该文本对象词自动通过width
属性自动换行。 However, I would like this text to automatically clip the top line of the text when the text object wraps to a 4th line. 但是,我希望此文本在文本对象换行到第4行时自动剪切文本的顶行。
So go from this: 因此,从此:
aaaa
bbbbbb
cccc
dddddd <- incoming new text
To this: 对此:
bbbbbb
cccc
dddddd
Any good way to do this? 有什么好办法吗?
Any good way to do this? 有什么好办法吗?
No, there is no way to cause canvas text items to clip the way you want. 不,没有任何方法可以使画布文本项以所需的方式裁剪。
You can simply scroll the Text widget. 您可以简单地滚动“文本”小部件。
See the code here: https://github.com/decadenza/blondieautoscroll 在此处查看代码: https : //github.com/decadenza/blondieautoscroll
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.