I am using an onscreen keyboard to type data for a tkinter based gui.
I was able to use the entry field to enter, edit data through the onscreen keyboard such as getting current cursor position and length of the string.
temp = self.entry_label.get()
length_string=len(temp)
cursor_position = self.entry_label.index(INSERT)
But I wish to do the same for a Text widget. I could get the text for Text widget using get()
method and its length but cannot get the current mouse cursor position.
temp=self.new_text.get(1.0, END)
cursor_position = self.new_text.index(INSERT)
Acutally it works and i am able to add character to that poisition , but after adding character cursor goes back to origional position , i.e last character
maybe This works? Else maybe text_widget.index(Tkinter.INSERT)
is what should work.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With