Re: use of ed sharp for python

  • From: Jamal Mazrui <empower@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Fri, 7 Mar 2008 07:27:59 -0500 (EST)

Assuming Python has been installed at the default location of
C:\python25
take the following steps:

Load EdSharp and create a file called test.py containing the following
line of code:
print("Hello world")

Press Shift+F10 for the Context Menu and choose Open With.  Press the
Browse button, and in the open file dialog that activates, enter the path
to the Python folder
c:\python25
Upon returning to the Open With dialog, check the checkbox to always use
this program to open the file type, and press OK.

Now press Control+E for Environment Variables, press the User button,
and press Alt+P for the PATH edit box.  If you do not find the Python
folder in the list of folders, press Home to get to the start, input
c:\python25;
(notice the semicolon character between each folder)
and press Enter to accept.   If you had to
ad the Python folder to the
path, restart Windows to ensure the new settings take effect.

In EdSharp again, press Control+Shift+F5 and choose the Python compiler.
  Press Alt+R for Recent Files and open test.py again.

Press Control+F5 to compile and run the program.  You should hear "Hello
world" because EdSharp captures standard output and speaks it.  If there
was a syntax error instead, EdSharp should say the error message and put
the cursor at that location.  To review the output of a compile, Press
Alt+Shift+F5, and a new editing window will open with the most recent
output as text.

If the program is working, you can press F5 to run it.  In this
situation, however, EdSharp does not monitor the standard and error
output streams, so they will not be spoken and cannot be
reviewed afterward.  The Run command, F5, is just like
entering the full path to the file in the Windows Start/Run
dialog.  Windows looks up the program associated with that
extension in the Registry, and launches the program with the
file as a command-line parameter.

Other EdSharp commands useful to Python programming are those for
managing indentation.  Tab indents the current or selected lines by
one level, and Shift+Tab does the reverse.  Alt+I says the current
indent level.  Control+I moves the cursor forward to the next change
in indentation, and Control+Shift+I does the reverse.  Shift+Enter
starts a new line with the same indentation as the current one.
Alt+Shift+I turns on Indent mode, where changes in indentation are
automatically announced as you navigate, and the roles of the Enter
and Shift+Enter keys are reversed.  Press Alt+Shift+I again to toggle
off that mode.

EdSharp also supports inputting Python code in a format with braces
instead of indentation -- called PyBrace format.  An opening brace
({) should replace the colon character (:) at the start of a block of
code.  A closing brace (}) should be placed on a line by itself at
the end of the block (e.g., an if, while, or for block).  You can
then press Alt+LeftBracket to generate indented code understood by
the Python interpreter -- called PyDent format.  The reverse is also
possible:  Alt+Shift+LeftBracket will generate PyBrace from PyDent
format.  The generated file is put in a new editing window, and
should then be saved to disk if it appears as expected.

An example of corresponding PyBrace and PyDent formats is in the
fruit basket demo program I did for Python, available at
http://www.EmpowermentZone.com/py_fruit.zip

There are a few Python programmers on this list who use EdSharp, so I hope
they also chime in if they have additional tips to share.

Jamal
Jamal
On Thu, 6 Mar 2008, programming wrote:

> Date: Thu, 6 Mar 2008 11:26:04 -0600
> From: programming <rproglock@xxxxxxx>
> Reply-To: programmingblind@xxxxxxxxxxxxx
> To: programmingblind@xxxxxxxxxxxxx
> Subject: use of ed sharp for python
>
> Hi List,
> I am using windows xp, ed sharp 2.6, and python 2.5.
>
>     If I type Python source code into Ed sharp, How do I interface this code 
> with the python interpreter?
> Thanks for your help.
>
> If you desire to respond off list, my email address is:
>
> rproglock@xxxxxxx
>
>
__________
View the list's information and change your settings at 
//www.freelists.org/list/programmingblind

Other related posts: