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

时间:2017-12-24 12:33:30

标签: python python-3.x wxpython wxtextctrl wxpython-phoenix

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

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

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

当前行当然意义:InserionPoint当前所在的行。

任何帮助表示赞赏:)。

1 个答案:

答案 0 :(得分:1)

尝试:

    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)