Hey, I'm new to python so don't judge.

Terry Reedy tjreedy at udel.edu
Thu Jan 5 00:04:17 EST 2017

On 1/4/2017 9:51 PM, Steven D'Aprano wrote:
> On Thursday 05 January 2017 10:21, Terry Reedy wrote:

>> IDLE does this when one runs code from the editor, because it
>> cannot/should not inject error messages into the editor buffer...
>> AND it replaces the ^ with red highlighting of the code pointed to.  No
>> information is lost.  Apparently, some beginners do not see the
>> connection between the SyntaxError box and the red highlighting.
> Some people may not even be able to distinguish red from other colours. Those
> with red-green colourblindness will probably see the red as a sort of muddy
> brown that hardly stands out as different from usual black text.
> http://wearecolorblind.com/
> One should never use colour alone as the only indicator of status.
> http://stackoverflow.com/questions/1498669/gui-design-for-color-blindness
> http://davemeeker.com/color-blind-considerations-for-ui-design/

I have described what I inherited.  After I wrote this, it occurred to 
me that perhaps the error color should be flashing, a bell rung, and 
maybe even the line and column numbers included in the box.

>> I
>> think I should add something to the box.  Maybe 'The error was detected
>> at the point of the red highlighting.'
> I just tested the REPL in idle for 2.7.4, and I get this:
>>>> print Hello World
> SyntaxError: invalid syntax
> where "print" is green text on a white background, and "World" is black text on
> a red background. That may be unfriendly to the colourblind, and makes coping
> and pasting the error less helpful. I suggest:
> - check the colours in a colourblindness simulator, and pay attention to the
> contrast; is the text still clear?

User can configure most of the syntax colors.  I am not sure ir the 
error 'red' is one of them or not.

#Suggestion 1
> - include the ^ caret as the primary status indicator, delegating colour to
> secondary; this makes errors in IDLE a little more like the same experience in
> the standard REPL.

Indeed, why not both in the Shell?  IDLE must currently be deleting the 
caret line.

> If I open a Python file containing:
> print Hello World
> and choose "Check Module", IDLE highlights the word "World" in red and displays
> a dialog showing:
> There's an error in your program:
> invalid syntax

#Suggestion 2
> Change the dialog box to display a read-only text field showing the traceback:
>   File "idletest.py", line 1
>     print Hello World
>                     ^
> SyntaxError: invalid syntax

#Suggestion 3
> and add a button "Copy traceback" to allow the user to copy the text of the
> traceback and paste it into an email.
> (Strictly speaking, the Copy button is redundant if the user can select the
> text in the field, but beginners may not realise the text can be selected.)

Thank you for the suggestions.  I will keep a copy of this.

Terry Jan Reedy

More information about the Python-list mailing list