简体   繁体   English

在tkinter文本小部件中设置插入字符的位置

[英]Setting the position of the insert character in the tkinter text widget

I'd like to change the position of the insert character in a tkinter text widget. 我想在tkinter文本小部件中更改插入字符的位置。 Is there a method or any other way which will help me set the position where the insert character is at in the text widget? 有没有一种方法或任何其他方式可以帮助我设置文本小部件中插入字符的位置?

You can use mark_set method with insert mark. 您可以将mark_set方法insert标记一起使用。

For example: 例如:

t.mark_set('insert', '2.3')

or 要么

t.mark_set(INSERT, '2.3')

Above code will position a cursor after the 3rd character in 2nd line. 上面的代码将光标定位在第二行的第三个字符之后。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM