benzeman
Posts: 108
Joined: Fri Apr 20, 2012 12:04 pm
Contact: Website

Python without a mouse

Fri Aug 10, 2012 4:26 pm

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

User avatar
croston
Posts: 703
Joined: Sat Nov 26, 2011 12:33 pm
Location: Blackpool
Contact: Website

Re: Python without a mouse

Fri Aug 10, 2012 4:31 pm

Yes. I use nano for Python programming more than Geany.

benzeman
Posts: 108
Joined: Fri Apr 20, 2012 12:04 pm
Contact: Website

Re: Python without a mouse

Fri Aug 10, 2012 4:34 pm

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!

Riccardo90
Posts: 14
Joined: Sun Jun 17, 2012 5:55 pm
Location: IT

Re: Python without a mouse

Fri Aug 10, 2012 7:39 pm

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
... sorry for my crappy english

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2869
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: Python without a mouse

Fri Aug 10, 2012 7:57 pm

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.
Alex Eames RasPi.TV, RasP.iO

KCarscadden
Posts: 56
Joined: Sat Jun 09, 2012 9:00 pm
Location: Canada

Re: Python without a mouse

Fri Aug 10, 2012 11:32 pm

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.

antiloquax
Posts: 406
Joined: Sun Nov 20, 2011 11:37 am
Contact: Website

Re: Python without a mouse

Sat Aug 11, 2012 5:09 am

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

Return to “Python”