interact.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:remoteControlPPT 作者: htwenning 项目源码 文件源码
def AppendToPrompt(self,bufLines, oldPrompt = None):
        " Take a command and stick it at the end of the buffer (with python prompts inserted if required)."
        self.flush()
        lastLineNo = self.GetLineCount()-1
        line = self.DoGetLine(lastLineNo)
        if oldPrompt and line==oldPrompt:
            self.SetSel(self.GetTextLength()-len(oldPrompt), self.GetTextLength())
            self.ReplaceSel(sys.ps1)
        elif (line!=str(sys.ps1)):
            if len(line)!=0: self.write('\n')
            self.write(sys.ps1)
        self.flush()
        self.idle.text.mark_set("iomark", "end-1c")
        if not bufLines:
            return
        terms = (["\n" + sys.ps2] * (len(bufLines)-1)) + ['']
        for bufLine, term in zip(bufLines, terms):
            if bufLine.strip():
                self.write( bufLine + term )
        self.flush()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号