Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit dac238b

Browse files
committed
When reading from stdin (with the dialog box) use any partial line on
stdout as the prompt. This makes raw_input() and print "xxx", ; sys.stdin.readline() work a bit more palatable.
1 parent 1af03e9 commit dac238b

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

Mac/Tools/IDE/PyConsole.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -340,8 +340,15 @@ class SimpleStdin:
340340

341341
def readline(self):
342342
import EasyDialogs
343+
# A trick to make the input dialog box a bit more palatable
344+
if hasattr(sys.stdout, '_buf'):
345+
prompt = sys.stdout._buf
346+
else:
347+
prompt = ""
348+
if not prompt:
349+
prompt = "Stdin input:"
343350
sys.stdout.flush()
344-
rv = EasyDialogs.AskString("")
351+
rv = EasyDialogs.AskString(prompt)
345352
if rv is None:
346353
return ""
347354
return rv + '\n'

0 commit comments

Comments
 (0)