Reputation: 52911
Is it possible to get the x y coordinates of the insertion cursor in a Tkinter Text widget? I'm trying to make a popup menu that pops up next to the insertion cursor.
Upvotes: 2
Views: 649
Reputation: 385900
The bbox
method can be used to get the bounding box of an index. You can use that to get the position relative to the window. You can use the winfo
method to get the x/y of the window.
Typically popups appear next to the mouse rather than the insertion point (though typically, right-clicking first sets the insertion point and then displays a menu).
Upvotes: 3