Set cursor position in a Text widget

前端 未结 3 2015
独厮守ぢ
独厮守ぢ 2020-12-31 16:28

Is it possible to set the cursor position in a Tkinter Text widget? I\'m not finding anything terribly useful yet.

The best I\'ve been able to do is emit a <

3条回答
  •  长发绾君心
    2020-12-31 16:52

    This property is just for Text Widget, because for Entry Widget we could use:

    entry_widget_name.icursor("position")
    

    For Text Widget will be:

    text_widget_name.mark_set("insert", "%d.%d" % (x,y))
    

    where x = row position y = column position

    (using integer numbers with dots like 1.0 or 3.0 for example)

提交回复
热议问题