In python you have two choices to learn how to program,one is with command line version and another is IDLE.I’ll explain both these methods one by one.
Command Line
Command line version of python is already installed in ubuntu.To get into python’s interactive mode,Click on Appliations>Accesorries>Terminal.Then type ‘python’ without quotes,that will open up the interactive mode of the python.Now you can test your python scripts.
You can also write the program with help of text editor like gedit or emacs.Then save it with extension .py.Now if you want to execute that file,then open the terminal,move yourself to the directory where that .py file exists.Then type the following commands in terminal.
python hello.py
this will execute the program.Once program is executed you’ll return back to the command prompt.To exit from the python interpreter type the following:
import sys;sys.exit();
or you can use exit(); or CTRL-D
This will exit from the interpreter and return back to the terminal.
IDLE
If you don’t want to use the command line version of python then there is another choice “IDLE”.IDLE means interactive developement envirement.IDLE is a Python IDE that includes a GUI debugger based on pdb.IDLE is not installed in ubuntu by default,you have to install it from DVD.To install the IDLE,follow these steps.
Click on Application>Add-remove applications.
In Add-remove applcations select categary > Programming >then Select “IDLE” check-box point.Click OK.Then it will ask for the install disk and then installs it from there.
Now you can write your program with help of text editor like emacs/gedit.Once you’re done with it,save it with extension .py.Now right click “Open with” thenĂ‚ select >IDLE. OR you can open the file from IDLE.IDLE shows the colored syntax of your program.Now to run your program,follow these steps:
Click>RUN>Run Module.
This will execute the program in the IDLE.
(Graphical user interface-GUI for Python)
Once you learn the techniques of the text processing in python.Then you need to learn how to program applications in GUI.To program GUI based applcations you have many option like Wxpython,Tkinter,Pyqt etc.
Tkinter is a GUI widget set for Python.There are many introductory tutorials for the Tkinter on the web. Some of them are :
[1] Introduction to python
[2] Python and Tkinter Programming by John Grayson (Manning, 2000, ISBN 1-884777-81-3)
[3] Tkinter reference [Here]
WxPython is another GUI toolkit for the Python programming language which allows easy creation of graphical user interfaces.You can obtain more information about Wxpython here.http://wxpython.org
You can learn more from python community so check out the activestate’s “CookBook” where you can learn a lot about the python coding.
I hope above information helps.If you have any quesstion & suggestion or errors.Then please don’t hesitate to post it over here.
No comments:
Post a Comment