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()
评论列表
文章目录