[wxPython-users] How to get the caret position within the
wx.TextCtrl?
Chris Mellon
arkanes at gmail.com
Tue Jan 2 08:33:25 PST 2007
On 1/1/07, vronskij <vronskij at gmail.com> wrote:
> Hi,
>
> I would like to get the current position of the caret within the
> wx.TextCtrl. I want to display a window near that caret, so I need to get
> it's position. Preferably the position on the whole screen.
> There is a GetCaret() method in wx.Window base class and the caret has a
> GetPosition() method which is probably the way to go. But the GetCaret()
> method returns None in my example.
>
> Am I missing something? How do I accomplish this?
> I tried several workerounds. To no effect.
>
>
> I am running Linux and wxPython 2.6.3.3
>
<snipped>
GetCaret is misleadingly named (it'll return a wxCaret object on some
platforms). What you want is GetInsertionPoint(), combined with
PositionToXY().
More information about the wxpython-users
mailing list