Python Devlopment






Command Line-2



Write a python program to display labels like Name, Branch and College along with entry boxes on the GUI window and "Submit" Button and when you press submit button display accepted information on command window.

from Tkinter import *
win = Tk()   # created Object a of tk
win.geometry('350x250')    # Specify the size of Window
win.title("My Project " )   # Title of the window

l1=Label(win,text="Name")   	# Label Name
l1.grid(row=0)			# Decide position of Label
e1=Entry(win)			# Text box1
e1.grid(row=0,column=1)		# Decide Position of Textbox1

l2=Label(win,text="Branch")
l2.grid(row=1)
e2=Entry(win)
e2.grid(row=1,column=1)

l3=Label(win,text="College")
l3.grid(row=2)
e3=Entry(win)
e3.grid(row=2,column=1)

cb1=Checkbutton(win,text="Keep Me Logged In") # Checkbutton
cb1.grid(columnspan=2)

def helloCallback():   # function to display on command line
	word1=e1.get()
	word2=e2.get()
	word3=e3.get()
	print(word1)
	print(word2)
	print(word3)

bt = Button(win, text="Submit",command=helloCallback)  # Put Button
bt.grid(row=4, column=1)		# Position of Button

win.mainloop()    # To display Window