<s>[INST] import tkinter as tk
from tkinter import messagebox
def applicationOperation():
    messagebox.showinfo("Congratulations")
    result = str(entry.get())
    print(result)
root = tk.Tk()
root.title("Automation Task")
label = tk.Label(root, text="hello")
label.pack()

button = tk.Button(root, text="Click Me!", command=applicationOperation)
button.pack()

entry = tk.Entry(root, width=20)
entry.pack()
root.mainloop()

Here is my script. In this script, I have created a simple GUI application using Python and tkinter library. On click of the button "Click Me!" , a message box will pop up with a text "Congratulations". 
However I have to click twice on the "Click Me" button for the first time before the textфтovice of the Entry appears in the console. However for all other subsequent application of button it works just fine. 

Please advice the reason why it works in this way. 

Also please suggest the how the GUI designing methods like pack() or grid() or place() are used in tkinter?[/INST]