##########################################################################################
# Create a Tkinter screen with label, Text field and button
# The text field has vertical and horizontal scroll bars
##########################################################################################
from tkinter import *			            #import entire tkinter framework
from tkinter import messagebox              #import popup dialogs 

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

win = Tk( )					                            #call Tk( ) constructor to create a root window
win.title("Tkinter Window with scrolling Text field")   #set a window title
win.geometry("460x210")                                 #window size

frame1 = Frame( win, bg='cyan', bd=20)          #with border_space=20

commentLabel = Label(frame1, text="Enter your comments", bg="cyan")

commentFrame = Frame(frame1)
commentField = Text(   commentFrame, width=28, height=5, wrap="none")
cmtScrollH = Scrollbar(commentFrame, orient="vertical",   command=commentField.yview)
cmtScrollV = Scrollbar(commentFrame, orient="horizontal", command=commentField.xview)
commentField.config(yscrollcommand=cmtScrollH.set)
commentField.config(xscrollcommand=cmtScrollV.set)
cmtScrollH.pack(side="right",  fill="y")
cmtScrollV.pack(side="bottom", fill="x")
commentField.pack()

submitButton = Button(frame1, width=9, text="Submit", cursor='hand2', command=submitEvent)  #call submitEvent upon submit

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

commentLabel.grid(row=0, column=0, pady=6, padx=5, sticky=NE)
commentFrame.grid(row=0, column=1, pady=6, padx=5)
submitButton.grid(row=1, column=1, padx=5, pady=8, sticky=W)

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