Terry J. Reedy added the comment:

I have not tried your patch yet, but the relevant code seems to be

class ModifiedInterpreter(InteractiveInterpreter):
    def runcode(self, code):
        if code.co_filename[0] != '<': ## your patch
            self.tkconsole.write('Executing ' + code.co_filename + '\n')
        if self.tkconsole.executing:
            self.interp.restart_subprocess()

     def restart_subprocess(self, with_cwd=False):
        if was_executing:
            console.write('\n')
            console.showprompt()
        halfbar = ((int(console.width) - 16) // 2) * '='
        console.write(halfbar + ' RESTART ' + halfbar)

The 2 problems I see with the patch are that 1) it prints prematurely and 2) it 
does not replace RESTART. Both should be solved by passing the title string to 
restart_process as a new 'title' arg (title=' RESTART ').

The halfbar expression should use len(title). I believe 16 is 9 (len(' RESTART 
')) + 4 (len('>>> ')) + 3 (console.width (80) - 77). So
        halfbar = ((int(console.width) - len(title) - 7) // 2) * '='

I think the bar would be better without a prompt before it. If 
console.showprompt() is deleted, 7 becomes 3.
I will code this later.

----------
assignee:  -> terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue21192>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to