Tuesday, November 3, 2009

Write a python program with basic components


We have some toolkits like Tkinter,Pmw to develop python programs. I am giving one link where you can get all the required syntax's what ever you required.


Now i am showing how to write a simple python program by using these components. The interesting thing is the output of program is tictac game.

NOTE:
1. In program i am assigning "single quotes" ie empty string to every variable b1,b2 etc after global b1,b2 etc....
2. Please maintain indentation while your writing this program.

You Can Download Source Code From The Following Link.....


OUTPUT










































Here i am showing three output screen shots to understand the tictac game.


I hope now you can freely write any basic python programs like this....
All the best

Tuesday, October 13, 2009

How to install MySQL-python-1.2.2

Installation process for MySQLdb modules on MAC OS X
Compatible python and mysql vertions are python 2.5 ,mysql 5.1.30

1. Download the latest MySQL for python adapter from source forge.

2. $tar xzvf MySQL-python-1.2.2.tar.gz

3. Go to the path of MySQL-python-1.2.2 and type this command $ sudo python setup.py clean

4. In MySQL-python-1.2.2 folder , edit the file "_mysql.c"

4a. Remove the following
#ifdef unit
#define unit unsigned int
#endif

4b. change the following
uint port=MySQL-port;
uint client_flag=0;
to
unsigned int port=MySQL_Port;
unsigned int client_flag=0;

5. Create a symbolic link under lib to point to a sub-directory called mysql
$sudo ln -s /usr/local/mysql/lib /usr/local/mysql/lib/mysql

6. Edit the file setup_posix.py
mysql_config.path="mysql_config"
to
mysql_config.path="/usr/local/mysql/bin/mysql_config"

7. $sudo python setup.py build

8. $sudo python setup.py install

Note: If you get a 'gcc' error then try to get gcc package from Apple and install 'X-code' and all related gcc contents.
Now type $ sudo python setup.py clean
$ sudo python setup.py build
$ sudo python setup.py install
then restart your system.

9. Check this one in your python IDLE
>>>import MySQLdb
>>>

Good Luck .....

Saturday, October 10, 2009

To get a basic knowledge on Python.



Python Tutorial


First of all download Python 2.5.4 and IDLE 1.2.4 then now started your first python program with the help of the tutorial which is available by the above link.
Now we are learning only simple python programs or scripts. We don't want to consider any Database Applications. Once we get a basic knowledge on this one then we will move to Database application development part.