在 wxPython 中将 InsertionPoint 设置为当前行的末尾 wx.TextCtrl

Set InsertionPoint to end of current line in wxPython wx.TextCtrl

好的,所以我知道我可以做到:

curPos = self.LogWindow.GetInsertionPoint
lineNum = self.LogWindow.GetRange( 0, self.LogWindow.GetInsertionPoint() ).split("\n")
lineText = self.LogWindow.GetLineText(lineNum)

但是如何将 InsertionPoint 设置为当前 lint 的末尾?

Current line of course 意思:InserionPoint当前所在的行。

感谢任何帮助:)。

尝试:

    curPos = self.log.GetInsertionPoint()
    curCol,curRow = self.log.PositionToXY(curPos)
    lineNum = curRow
    lineText = self.log.GetLineText(lineNum)
    newPos=self.log.XYToPosition(len(lineText), curRow)
    self.log.SetInsertionPoint(newPos)