What is Python
ICE Interview Questions
Microprocessor and Microcontroller Interview:
AC DC Motor Interview:
Control System Interview:
Digital Signal Processing Interview:
Digital Electronics Interview:
Induction Motor Interview:
Machine Design Interview:
VLSI Interview:
Wireless Communication Interview:
Python Intership Project
Login.py
from tkinter import * #import tkinter library
import tkinter.messagebox as msg # to display message box
import sqlite3 #to store data
root = Tk()
root.geometry(“700×450+300+100”) #width height xoffset #yoffset
regimage = PhotoImage(file = “login.png”);
bg_Label = Label(root,image = regimage)
bg_Label.place(x=0,y=0,relwidth=1,relheight=1)
root.title(“Login Page – Medicine Management System”)
root.config
########### Variable declaration #########
UserName= StringVar()
Password= StringVar()
############## Lets write functions for the button ############
def register():
root.destroy()
import Reg
def login():
conn = sqlite3.connect(“medicine.db”)
cursor = conn.cursor()
user= str(UserName.get())
pwd = str(Password.get())
print (user)
print (pwd)
print (“select UserName from ‘usertable1’ where ‘UserName’=? and Pwd=?”,(user,pwd))
cursor.execute(“select UserName from usertable1 where UserName=? and Pwd=?”,(user,pwd))
resultset = cursor.fetchall();
for data in resultset:
print (data)
if data:
msg.showinfo(“Confirmation Message”,”Login successful Added”,icon=”info”)
root.destroy()
import home
else:
msg.showinfo(“Error Message”,”Invalid user”,icon=”warning”)
cursor.close()
def back():
root.destroy()
import home
#################### Lets put the controls ############
TopHeadingFrame = Frame(root,width=600,bd=1)
TopHeadingFrame.pack(side=TOP)
HeadingLabel = Label(TopHeadingFrame,text=”Login Page”,
font=(“Helvetica”,16),fg=”brown”, bg=”white”)
HeadingLabel.grid(row=0,column=1,padx=10,pady=10)
##########
MidFrame = Frame(root,width=600)
MidFrame.pack(side=TOP)
##########
UserNameLabel = Label(MidFrame,text=”UserName”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
UserNameLabel.grid(row=3,padx=10,pady=10)
##########
PasswordLabel = Label(MidFrame,text=”Password”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
PasswordLabel.grid(row=4,padx=10,pady=10)
##########
UserNameTextbox = Entry(MidFrame,textvariable=UserName,
font=(“Helvetica”,10))
UserNameTextbox.grid(row=3,column=1,padx=10,pady=10)
##########
PasswordTextbox = Entry(MidFrame,textvariable=Password,
font=(“Helvetica”,10))
PasswordTextbox.grid(row=4,column=1,padx=10,pady=10)
##########
##########
RegisterButton = Button(MidFrame,text=”Login”, command = login,
font=(“Helvetica”,10))
RegisterButton.grid(row=7,column=1,padx=10,pady=10)
##########
AlreadyUserLabel = Label(MidFrame,text=”Not registered ???”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
AlreadyUserLabel.grid(row=9,padx=10,pady=10)
##########
LoginButton = Button(MidFrame,text=”Register”, command=register ,
font=(“Helvetica”,10))
LoginButton.grid(row=9,column=1,padx=10,pady=10)
##########
BackButton = Button(MidFrame,text=”Back”, command=back,
font=(“Helvetica”,10))
BackButton.grid(row=10,column=0,padx=10,pady=10)
Reg.py
from tkinter import * #import tkinter library
import tkinter.messagebox as msg # to display message box
import sqlite3 #to store data
root = Tk()
root.geometry(“700×450+300+100”) #width height xoffset #yoffset
regimage = PhotoImage(file = “reg.png”);
bg_Label = Label(root,image = regimage)
bg_Label.place(x=0,y=0,relwidth=1,relheight=1)
root.title(“Medicine Management System”)
root.config
#########################Lets connect the database now #########
conn = sqlite3.connect(“medicine.db”)
cursor = conn.cursor()
cursor.execute(“create table if not exists ‘usertable1′(Name text,ID int, UserName text,Pwd text,mobile text, email text)”)
conn.commit()
########################Lets insert the data into table now #######
Name = StringVar()
ID= IntVar()
UserName= StringVar()
Password= StringVar()
Mobile= StringVar()
Email= StringVar()
Name.set(“”)
ID.set(“”)
UserName.set(“”)
Password.set(“”)
Mobile.set(“”)
Email.set(“”)
############## Lets write functions for the button ############
def register():
conn = sqlite3.connect(“medicine.db”)
cursor = conn.cursor()
cursor.execute(“insert into ‘usertable1′(Name ,ID, UserName,Pwd ,mobile, email) values(?,?,?,?,?,?)”,(str(Name.get()), str(ID.get()),str(UserName.get()),str(Password.get()),str(Mobile.get()),str(Email.get())))
conn.commit()
print(cursor.rowcount)
if cursor.rowcount >0:
msg.showinfo(“Confirmation Message”,”User Added”,icon=”info”)
else:
msg.showinfo(“Error Message”,”User not Added”,icon=”warning”)
def login():
root.destroy()
import login
def back():
root.destroy()
import home
#################### Lets put the controls ############
TopHeadingFrame = Frame(root,width=600,bd=1)
TopHeadingFrame.pack(side=TOP)
HeadingLabel = Label(TopHeadingFrame,text=”Medicine Mgnt System”,
font=(“Helvetica”,16),fg=”brown”, bg=”white”)
HeadingLabel.grid(row=0,column=1,padx=10,pady=10)
########################Plan for the controls in the mid####
MidFrame = Frame(root,width=600)
MidFrame.pack(side=TOP)
NameLabel = Label(MidFrame,text=”Name”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
NameLabel.grid(row=1,padx=10,pady=10)
##########
IDLabel = Label(MidFrame,text=”ID”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
IDLabel.grid(row=2,padx=10,pady=10)
##########
UserNameLabel = Label(MidFrame,text=”UserName”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
UserNameLabel.grid(row=3,padx=10,pady=10)
##########
PasswordLabel = Label(MidFrame,text=”Password”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
PasswordLabel.grid(row=4,padx=10,pady=10)
##########
MobileLabel = Label(MidFrame,text=”Mobile”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
MobileLabel.grid(row=5,padx=10,pady=10)
##########
EmailLabel = Label(MidFrame,text=”E-Mail”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
EmailLabel.grid(row=6,padx=10,pady=10)
##########
NameTextbox = Entry(MidFrame,textvariable=Name,
font=(“Helvetica”,10))
NameTextbox.grid(row=1,column=1,padx=10,pady=10)
##########
IDTextbox = Entry(MidFrame,textvariable=ID,
font=(“Helvetica”,10))
IDTextbox.grid(row=2,column=1,padx=10,pady=10)
##########
UserNameTextbox = Entry(MidFrame,textvariable=UserName,
font=(“Helvetica”,10))
UserNameTextbox.grid(row=3,column=1,padx=10,pady=10)
##########
PasswordTextbox = Entry(MidFrame,textvariable=Password,
font=(“Helvetica”,10))
PasswordTextbox.grid(row=4,column=1,padx=10,pady=10)
##########
MobileTextbox = Entry(MidFrame,textvariable=Mobile,
font=(“Helvetica”,10))
MobileTextbox.grid(row=5,column=1,padx=10,pady=10)
##########
EmailTextbox = Entry(MidFrame,textvariable=Email,
font=(“Helvetica”,10))
EmailTextbox.grid(row=6,column=1,padx=10,pady=10)
##########
RegisterButton = Button(MidFrame,text=”Register”, command=register,
font=(“Helvetica”,10))
RegisterButton.grid(row=7,column=1,padx=10,pady=10)
##########
AlreadyUserLabel = Label(MidFrame,text=”Already User ???”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
AlreadyUserLabel.grid(row=9,padx=10,pady=10)
##########
LoginButton = Button(MidFrame,text=”Login”, command=login,
font=(“Helvetica”,10))
LoginButton.grid(row=9,column=1,padx=10,pady=10)
##########
BackButton = Button(MidFrame,text=”Back”, command = back,
font=(“Helvetica”,10))
BackButton.grid(row=10,column=0,padx=10,pady=10)
AddMedicine.py
from tkinter import * #import tkinter library
import tkinter.messagebox as msg # to display message box
import sqlite3 #to store data
root = Tk()
root.geometry(“700×450+300+100”) #width height xoffset #yoffset
regimage = PhotoImage(file = “AddMedicine.png”);
bg_Label = Label(root,image = regimage)
bg_Label.place(x=0,y=0,relwidth=1,relheight=1)
root.title(“Add Medicine Page – Medicine Management System”)
root.config
#########################Lets create the table for medicine #########
conn = sqlite3.connect(“medicine.db”)
cursor = conn.cursor()
cursor.execute(“create table if not exists ‘medicine'(MedicineID int, MedicineName text,Company text, ChemicalComp text,ManuDate text,ExpDate text, Costfor10 text)”)
conn.commit()
###################Declare variables for the columns to access######3
MedicineName = StringVar()
MedicineID = IntVar()
Company= StringVar()
ChemicalComp= StringVar()
ManuDate= StringVar()
ExpDate= StringVar()
Costfor10= StringVar()
MedicineName.set(“”)
MedicineID.set(“”)
Company.set(“”)
ChemicalComp.set(“”)
ManuDate.set(“”)
ExpDate.set(“”)
Costfor10.set(“”)
############## Lets write functions for the button ############
def addmedicine():
conn = sqlite3.connect(“medicine.db”)
cursor = conn.cursor()
cursor.execute(“insert into ‘medicine'(MedicineName,MedicineID,Company,ChemicalComp,ManuDate,ExpDate,Costfor10) values(?,?,?,?,?,?,?)”,(str(MedicineName.get()),str(MedicineID.get()),str(Company.get()),str(ChemicalComp.get()),str(ManuDate.get()),str(ExpDate.get()),str(Costfor10.get())))
conn.commit()
print(cursor.rowcount)
if cursor.rowcount >0:
msg.showinfo(“Confirmation Message”,”Medicine Added Successfully”,icon=”info”)
else:
msg.showinfo(“Error Message”,”medicine not Added”,icon=”warning”)
def cancel():
root.destroy()
import home
def back():
root.destroy()
import home
##################Top Frame ###########
TopHeadingFrame = Frame(root,width=600,bd=1)
TopHeadingFrame.pack(side=TOP)
HeadingLabel = Label(TopHeadingFrame,text=”Add Medicine”,
font=(“Helvetica”,16),fg=”brown”, bg=”white”)
HeadingLabel.grid(row=0,column=1,padx=10,pady=10)
##########
MidFrame = Frame(root,width=600)
MidFrame.pack(side=TOP)
##########
MedicineNameLabel = Label(MidFrame,text=”Medicine Name”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
MedicineNameLabel.grid(row=1,padx=10,pady=10)
##########
MedicineIDLabel = Label(MidFrame,text=”Medicine ID”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
MedicineIDLabel.grid(row=2,padx=10,pady=10)
##########
CompanyLabel = Label(MidFrame,text=”Company”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
CompanyLabel.grid(row=3,padx=10,pady=10)
##########
ChemicalCompLabel = Label(MidFrame,text=”Chemical Composition”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
ChemicalCompLabel.grid(row=4,padx=10,pady=10)
##########
ManuDateLabel = Label(MidFrame,text=”Manufacturing Date”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
ManuDateLabel.grid(row=5,padx=10,pady=10)
##########
ExpDateLabel = Label(MidFrame,text=”Expiry Date”,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
ExpDateLabel.grid(row=6,padx=10,pady=10)
##########
Costfor10Label = Label(MidFrame,text=”Cost for 10″,
font=(“Helvetica”,10),fg=”brown”, bg=”white”)
Costfor10Label.grid(row=7,padx=10,pady=10)
##########
MedicineNameTextbox = Entry(MidFrame,textvariable=MedicineName,
font=(“Helvetica”,10))
MedicineNameTextbox.grid(row=1,column=1,padx=10,pady=10)
##########
MedicineIDTextbox = Entry(MidFrame,textvariable=MedicineID,
font=(“Helvetica”,10))
MedicineIDTextbox.grid(row=2,column=1,padx=10,pady=10)
##########
CompanyTextbox = Entry(MidFrame,textvariable=Company,
font=(“Helvetica”,10))
CompanyTextbox.grid(row=3,column=1,padx=10,pady=10)
##########
ChemicalCompTextbox = Entry(MidFrame,textvariable=ChemicalComp,
font=(“Helvetica”,10))
ChemicalCompTextbox.grid(row=4,column=1,padx=10,pady=10)
##########
ManuDateTextbox = Entry(MidFrame,textvariable=ManuDate,
font=(“Helvetica”,10))
ManuDateTextbox.grid(row=5,column=1,padx=10,pady=10)
##########
ExpDateTextbox = Entry(MidFrame,textvariable=ExpDate,
font=(“Helvetica”,10))
ExpDateTextbox.grid(row=6,column=1,padx=10,pady=10)
##########
Costfor10Textbox = Entry(MidFrame,textvariable=Costfor10,
font=(“Helvetica”,10))
Costfor10Textbox.grid(row=7,column=1,padx=10,pady=10)
##########
RegisterButton = Button(MidFrame,text=”Register”, command=addmedicine,
font=(“Helvetica”,10))
RegisterButton.grid(row=8,column=0,padx=10,pady=10)
##########
CancelButton = Button(MidFrame,text=”Cancel”, command=cancel,
font=(“Helvetica”,10))
CancelButton.grid(row=8,column=1,padx=10,pady=10)
##########
##########
BackButton = Button(MidFrame,text=”Back”, command = back,
font=(“Helvetica”,10))
BackButton.grid(row=10,column=0,padx=10,pady=10)
home.py
from tkinter import * #import tkinter library
import tkinter.messagebox as msg # to display message box
import sqlite3 #to store data
root = Tk()
root.geometry(“700×450+300+100”) #width height xoffset #yoffset
regimage = PhotoImage(file = “home.png”);
bg_Label = Label(root,image = regimage)
bg_Label.place(x=0,y=0,relwidth=1,relheight=1)
root.title(“Home Page – Medicine Management System”)
root.config
############## Lets write functions for the button ############
def AddMedicine():
root.destroy()
import AddMedicine
def ViewMedicine():
root.destroy()
import ViewMedicine
def SearchMedicine():
root.destroy()
import SearchMedicine
def DeleteMedicine():
root.destroy()
import DeleteMedicine
##################Top Frame ###########
TopHeadingFrame = Frame(root,width=600,bd=1)
TopHeadingFrame.pack(side=TOP)
HeadingLabel = Label(TopHeadingFrame,text=”Options to choose”,
font=(“Helvetica”,16),fg=”brown”, bg=”white”)
HeadingLabel.grid(row=0,column=1,padx=10,pady=10)
##########
MidFrame = Frame(root,width=600)
MidFrame.pack(side=TOP)
##########
AddMedicine = Button(MidFrame,text=”Add Medicine”, command=AddMedicine,
font=(“Helvetica”,10))
AddMedicine.grid(row=2,column=1,padx=10,pady=10)
##########
ViewMedicine = Button(MidFrame,text=”View Medicine”, command=ViewMedicine,
font=(“Helvetica”,10))
ViewMedicine.grid(row=4,column=1,padx=10,pady=10)
##########
SearchMedicine = Button(MidFrame,text=”Search Medicine”, command=SearchMedicine,
font=(“Helvetica”,10))
SearchMedicine.grid(row=6,column=1,padx=10,pady=10)
##########
DeleteMedicine = Button(MidFrame,text=”Delete Medicine”, command=DeleteMedicine,
font=(“Helvetica”,10))
DeleteMedicine.grid(row=8,column=1,padx=10,pady=10)