简体   繁体   中英

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. 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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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