Boston Python Workshop 6/Friday/Linux text editor: Difference between revisions

no edit summary
imported>Jesstess
(Created page with "Linux ships with Python installed, so the goal of this page is to make sure you can start a terminal and run Python from the command line. <ol> <li>Open a Terminal command p...")
 
imported>Jesstess
No edit summary
 
(One intermediate revision by the same user not shown)
Line 1:
== How to find gedit in the Applications list ==
Linux ships with Python installed, so the goal of this page is to make sure you can start a terminal and run Python from the command line.
 
On Linux, we suggest the GEdit text editor.
<ol>
<li>Open a Terminal command prompt. You can find the Terminal application at Applications/Accessories/Terminal, or it may already be on your menu bar.</li>
<li>To start Python, type
 
GEdit should already be installed on your computer. To start GEdit: click Applications, point to Accessories, and click Text Editor. If you don't have this option, let a staff member know.
<pre>
 
python
== How to find GEdit from a terminal ==
</pre>
 
If you prefer to start applications from a terminal, you can type the following into a terminal to launch GEdit:
 
at the comand prompt and hit enter. You should see something like
<pre>
gedit &
Python 2.7.1 (r252:60911, Jan 24 2011, 17:44:40)
[GCC 4.3.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
</pre>
 
== Configure gedit to indent with spaces ==
The <code>>>></code> indicates that you are at a Python prompt.</li>
<li>Exit the Python prompt by typing
 
* Click Edit -> Preferences
<pre>
* Select the tab labeled "Editor"
exit()
* In the "Tab width" field, set it to '''4''' (the default is 8)
</pre>
* '''Check''' the box labeled "Insert spaces instead of tabs"
* '''Check''' the box labeled "Enable automatic indentation"
* Click Close.
 
That's it! Now, you can hit tab to indent your code, and that indentation will actually be made of spaces. This change will help you use spaces consistently, so that Python doesn't get confused about whitespace.
and hitting enter. Now you're back at the Linux command prompt (which looks something like <code>jesstess$</code>).</li>
</ol>
 
=== Success!= ==
 
If you prefer a different editor for text, check with an instructor before moving on to make sure it will work for the weekend.
Practice these steps until you feel comfortable navigating to a command prompt, starting Python, and exiting Python.
 
[[Boston Python Workshop 6/Friday|&laquo; Back to the Friday setup page]]
Anonymous user