Page 1 of 1

Python without a mouse

Posted: Fri Aug 10, 2012 4:26 pm
by benzeman
I've been a bit of a banana, or should I say a raspberry.

I've taken my pi on holiday, to try and learn python, but I've forgotten the mouse! I haven't used python before, but I understand that I should use geaney from lxde. Can I use nano and the command prompt to try programming?

Thanks :)

Ben

Re: Python without a mouse

Posted: Fri Aug 10, 2012 4:31 pm
by croston
Yes. I use nano for Python programming more than Geany.

Re: Python without a mouse

Posted: Fri Aug 10, 2012 4:34 pm
by benzeman
croston wrote:Yes. I use nano for Python programming more than Geany.
Great! How? I'm at a blank command prompt. Sorry for being such a newb! Feel free to throw hyperlinks at me!

Re: Python without a mouse

Posted: Fri Aug 10, 2012 7:39 pm
by Riccardo90
python scripts are nothing more than text files

Code: Select all

nano filename.py
it's not necessary that the script has .py extension but nano highlights the syntax if the file has the right extension

once you have written the script save and exit
to run the script type:

Code: Select all

python filename.py
if in your script you use the gpio module you have to run the script with administrator rights

Re: Python without a mouse

Posted: Fri Aug 10, 2012 7:57 pm
by alexeames
benzeman wrote:
croston wrote:Yes. I use nano for Python programming more than Geany.
Great! How? I'm at a blank command prompt. Sorry for being such a newb! Feel free to throw hyperlinks at me!
OK - here's one. If you can stomache the style and skip the bits which are too basic (if you find them so) you might find this one quite helpful.

http://learnpythonthehardway.org/

As far as using nano is concerned, it's a breeze. Just give it a go.

Re: Python without a mouse

Posted: Fri Aug 10, 2012 11:32 pm
by KCarscadden
A convenient thing to do when you are testing/debugging a program/python module is to create one terminal to the raspberry pi to use for editing, and when you are finished editing, save the module, but don't exit the editor.

Then in another terminal to the raspberry pi, use

python xx.py

to execute the module. If everything works, then great! But if something needs editing, go back to the other terminal/editing session, edit the module, save, then go back to the other terminal and execute again.

This is slightly faster than editing, exiting, executing, editing again, exiting, executing, etc. in one terminal only.

Re: Python without a mouse

Posted: Sat Aug 11, 2012 5:09 am
by antiloquax
I've collected a few links to tutorials that are useful here:
raspberrypy.co

Also there are a few Python Tutorial videos on my YouTube channel:
Python Tutorial Playlist