If you are new to python programming and if you’re using ubuntu linux as your operating system then you can start programming easily as Ubuntu comes up with the command line version of python pre-installed.Ubuntu community develops its own tools and scripts under python,so you can learn a lot from the community. Official Community also offers bounties on some of its python projects. So in that way you can also get in touch with the experienced python developers.
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 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.
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:
or you can use exit(); or CTRL-D
This will exit from the interpreter and return back to the terminal.
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:
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 :
 Python and Tkinter Programming by John Grayson (Manning, 2000, ISBN 1-884777-81-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 from official wxpython website.
You can learn more from python community so check out the activestate’s “CookBook” where you can learn a lot about the python coding.
More Python Tutorials
- Python Dictionaries
- Python Tuples
- Python Lists
- Python Date and Time
- SQlite Python
- Python easy_install modules
I hope above information helps.If you have any quesstion & suggestion or errors.Then please don’t hesitate to post it over here.