##########################################################################################
# Create a Tkinter screen with label, entry field and button
##########################################################################################
from tkinter import *			            #import entire tkinter framework
from tkinter import messagebox              #import popup dialogs 

def submitEvent( ):                                         #method is called upon submit
    name = nameField.get()                                  #get value entered in Entry field
    messagebox.showinfo('Thanks', F"You entered: {name}")   #display a popup dialog
 
#### Create the window components ###########################################################

win = Tk( )					                    #call Tk( ) constructor to create a root window
win.title("Tkinter Window with Entry field")	#set a window title
win.geometry("350x100")                         #window size

frame1 = Frame( win, bg='cyan')

nameLabel    = Label(frame1, text="Enter you name  ", bg="cyan")    #create components
nameField    = Entry(frame1, width=30)
submitButton = Button(frame1, width=9, text="Submit", cursor='hand2', command=submitEvent)  #call submitEvent upon submit

#### Place components in window ###########################################################

nameLabel.grid(   row=0, column=0, pady=6, padx=5, sticky=E)        #place the components in the frame
nameField.grid(   row=0, column=1, pady=6, padx=5, sticky=W)
submitButton.grid(row=5, column=0, padx=5, pady=8, sticky=E)

frame1.pack()                                                       #make the frame visible
win.mainloop()                                                      #make the window visible