STUDENT MARKLIST APPLICATION
PROGRAM:
from Tkinter import *
import MySQLdb
def func():
conn = [Link] (host = "localhost", user = "root",passwd = "jec",db = "test")
cursor = [Link] ()
[Link](0, END)
name=[Link]().strip()
roll=int([Link]().strip())
m1=int([Link]().strip())
m2=int([Link]().strip())
m3=int([Link]().strip())
if m1=="" or m2 =="" or m3=="" : return
avg = (m1 + m2 + m3) / 3
[Link](0,avg)
[Link]("insert into stud values('"+name+"',"+str(roll)
+","+str(m1)+","+str(m2)+","+str(m3)+","+str(avg)+")")
[Link] ()
[Link] ()
master = Tk()
[Link]("student record")
Label1 = Label(master,text="name")
[Link]()
Box1=Entry(master)
[Link]()
Label2 = Label(master,text="roll")
[Link]()
Box2=Entry(master)
[Link]()
Label3 = Label(master,text="m1")
[Link]()
Box3=Entry(master)
[Link]()
Label4 = Label(master,text="m2")
[Link]()
Box4=Entry(master)
[Link]()
Label5 = Label(master,text="m3")
[Link]()
Box5=Entry(master)[Link]()
Label6 = Label(master,text="avg")
[Link]()
Box6=Entry(master)
[Link]()
button = Button(master, text="Submit", command=func).pack()
mainloop()
OUTPUT:
jec@jec-desktop:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 44
Server version: 5.0.75-0ubuntu10.2 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use test
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> select * from stud;
+------+------+------+------+------+------+
| name | roll | m1 | m2 | m3 | avg |
+------+------+------+------+------+------+
| 11 | 11 | 11 | 11 | 11 | 11 |
| sam | 78 | 89 | 89 | 89 | 89 |
| sam | 78 | 89 | 89 | 89 | 89 |
+------+------+------+------+------+------+
3 rows in set (0.00 se
PAYROLL
APPLICATION
PROGRAM:
from Tkinter import *
import MySQLdb
def func():
conn = [Link] (host = "localhost", user = "root",passwd = "jec",db = "test")
cursor = [Link] ()
[Link](0, END)
[Link](0,END)
[Link](0,END)
[Link](0,END)
name=[Link]().strip()
no=int([Link]().strip())
basicpay=int([Link]().strip())
cca=int([Link]().strip())
if name=="" or no =="" or basicpay=="" or cca=="" : return
da=90*basicpay/100
hra=20*basicpay/100
itax=10*basicpay/100
netpay=(basicpay+da+hra+cca)-itax
[Link](0,da)
[Link](0,hra)
[Link](0,itax)
[Link](0,netpay)
[Link]("insert into payroll values('"+name+"',"+str(no)+","+str(basicpay)+","+str(da)
+","+str(hra)+","+str(cca)+","+str(itax)+","+str(netpay)+")")
[Link] ()
[Link] ()
master = Tk()
Label1 = Label(master,text="name")
[Link]()
Box1=Entry(master)
[Link]()
Label2 = Label(master,text="no")
[Link]()
Box2=Entry(master)
[Link]()
Label3 = Label(master,text="basicpay")
[Link]()
Box3=Entry(master)
[Link]()
Label4 = Label(master,text="da")
[Link]()
Box4=Entry(master)
[Link]()
Label5 = Label(master,text="hra")
[Link]()
Box5=Entry(master)
[Link]()
Label6 = Label(master,text="cca")
[Link]()
Box6=Entry(master)
[Link]()
Label7 = Label(master,text="itax")
[Link]()
Box7=Entry(master)
[Link]()
Label8 = Label(master,text="netpay")
[Link]()
Box8=Entry(master)
[Link]()
button = Button(master, text="Submit", command=func).pack()
mainloop()
OUTPUT:
jec@jec-desktop:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 31
Server version: 5.0.75-0ubuntu10.2 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use test
Database changed
mysql> create table payroll(name varchar(20),no int,basicpay int,da float,hra float,cca int,itax
float,netpay float)
-> ;
Query OK, 0 rows affected (0.01 sec)
mysql> select * from payroll;
+------+------+----------+------+------+------+------+--------+
| name | no | basicpay | da | hra | cca | itax | netpay |
+------+------+----------+------+------+------+------+--------+
| Shah | 10 | 1000 | 900 | 200 | 2000 | 100 | 4000 |
+------+------+----------+------+------+------+------+--------+
1 row in set (0.00 sec)
LIBRARY MANAGEMENT APPLICATION
PROGRAM:
from Tkinter import *
import MySQLdb
def func():
first= Tk()
Label1 = Label(first,text="bkno")
[Link]()
Box1=Entry(first)
[Link]()
Label2 = Label(first,text="bkname")
[Link]()
Box2=Entry(first)
[Link]()
Label3 = Label(first,text="author")
[Link]()
Box3=Entry(first)
[Link]()
Label4 = Label(first,text="publisher")
[Link]()
Box4=Entry(first)
[Link]()
def func1():
conn = [Link] (host = "localhost", user = "root",passwd = "jec",db = "test")
cursor = [Link] ()
bkno=int([Link]().strip())
bkname=[Link]().strip()
author=[Link]().strip()
publisher=[Link]().strip()
if bkno=="" or bkname =="" or author=="": return
[Link]("insert into library values("+str(bkno)+",'"+(bkname)+"','"+(author)+"','"+
(publisher)+"')")
[Link] ()
[Link] ()
Button3 = Button(first, text="INSERT", command=func1).pack()
def select():
second = Tk()
Label1 = Label(second,text="bkno")
[Link]()
Box1=Entry(second)
[Link]()
Label2 = Label(second,text="bkname")
[Link]()
Box2=Entry(second)
[Link]()
Label3 = Label(second,text="author")
[Link]()
Box3=Entry(second)
[Link]()
Label4 = Label(second,text="publisher")
[Link]()
Box4=Entry(second)
[Link]()
def func2():
conn = [Link] (host = "localhost", user = "root",passwd = "jec",db = "test")
cursor = [Link] ()
bkno=int([Link]().strip())
bkname=[Link]().strip()
author=[Link]().strip()
publisher=[Link]().strip()
[Link](0, END)
[Link](0, END)
[Link](0, END)
[Link](0, END)
try:
sql="select * from library where bkno> '%d'" % bkno
[Link](sql)
row1=[Link] ()
[Link](0,row1[0])
[Link]()
[Link](0,row1[1])
[Link]()
[Link](0,row1[2])
[Link]()
[Link](0,row1[3])
[Link]()
[Link]()
[Link]()
except:
print "Error:End of the table"
Button3 = Button(second, text="NEXT", command=func2).pack()
master = Tk()
Button1 = Button(master, text="INSERT", command=func).pack()
Button2 = Button(master, text="SELECT", command=select).pack()
mainloop()
OUTPUT:
jec@jec-desktop:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 33
Server version: 5.0.75-0ubuntu10.2 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use test
Database changed
mysql> select * from library;
+------+--------+--------------+-----------+
| bkno | bkname | author | publisher |
+------+--------+--------------+-----------+
| 100 | DBMS | Silberschatz | Pearlin |
+-----+--------+--------------+-----------+
1 row in set (0.00 sec)
BANK APPLICATION
PROGRAM:
from Tkinter import *
import MySQLdb
def func():
first= Tk()
Label1 = Label(first,text="accno")
[Link]()
Box1=Entry(first)
[Link]()
Label2 = Label(first,text="name")
[Link]()
Box2=Entry(first)
[Link]()
Label3 = Label(first,text="balance")
[Link]()
Box3=Entry(first)
[Link]()
def func1():
conn = [Link] (host = "localhost", user = "root",passwd = "jec",db = "test")
cursor = [Link] ()
accno=int([Link]().strip())
name=[Link]().strip()
balance=int([Link]().strip())
if accno=="" or name =="" or balance=="": return
[Link]("insert into account values('"+name+"',"+str(accno)+","+str(balance)+")")
[Link] ()
[Link] ()
Button3 = Button(first, text="add", command=func1).pack()
def debit():
second = Tk()
Label1 = Label(second,text="acc")
[Link]()
Box1=Entry(second)
[Link]()
Label3 = Label(second,text="balance")
[Link]()
Box3=Entry(second)
[Link]()
Label4 = Label(second,text="amount")
[Link]()
Box4=Entry(second)
[Link]()
def func2():
conn = [Link] (host = "localhost", user = "root",passwd = "jec",db = "test")
cursor = [Link] ()
acc=int([Link]().strip())
balance=int([Link]().strip())
amount=int([Link]().strip())
[Link]("update account set balance="+str(balance)+"-"+str(amount)+" where
accno="+str(acc)+"")
if acc=="" or balance=="": return
[Link] ()
[Link] ()
Button3 = Button(second, text="SUBMIT", command=func2).pack()
def trans():
third= Tk()
Label1 = Label(third,text="From account")
[Link]()
Box1=Entry(third)
[Link]()
Label2 = Label(third,text="To account")
[Link]()
Box2=Entry(third)
[Link]()
Label3 = Label(third,text="Amount")
[Link]()
Box3=Entry(third)
[Link]()
def func3():
conn = [Link] ("localhost","root","jec","test")
cursor = [Link] ()
From=int([Link]().strip())
To=int([Link]().strip())
Amount=int([Link]().strip())
[Link]("select balance from account where accno="+str(From)+"")
a=[Link] ()
fromval=int(a[0])
[Link]("select balance from account where accno="+str(To)+"")
b=[Link] ()
toval=int(b[0])
fromval=fromval-Amount
toval=toval+Amount
[Link]("update account set balance="+str(fromval)+" where accno="+str(From)+"")
[Link]("update account set balance="+str(toval)+" where accno="+str(To)+"")
[Link] ()
[Link] ()
Button3 = Button(third, text="NEXT", command=func3).pack()
master = Tk()
Button1 = Button(master, text="CREDIT", command=func).pack()
Button2 = Button(master, text="DEBIT", command=debit).pack()
Button3 = Button(master, text="TRANSACTION", command=trans).pack()
mainloop()
OUTPUT:
jec@jec-desktop:~$ mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 34
Server version: 5.0.75-0ubuntu10.2 (Ubuntu)
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> use test
Database changed
mysql> select * from bank;
mysql> select * from account;
+------+-------+---------+
| name | accno| balance|
+------+-------+---------+
| Shah | 100 | 400 |
| Rukh | 200 | 1000 |
+------+-------+---------+
2 rows in set (0.02 sec)