title: How to make a condition that states when you click a button your input will show as messagebox
body: <p>I don't know how to print the calculator's answer outside the place where it is entered.</p>
  <p>The code that I want to insert is:</p>
  <pre><code>Button(master, text=&quot;Submit&quot;,width=23, height=3, command=lambda(?)).grid(row=5, column=0, columnspan=3)
  </code></pre>
  <p>? = The thing that i want to be define</p>
  <p>I want the text in the entry, <code>self.e</code> to be printed outside of the entry in a messagebox or a label.</p>
  <pre class="lang-py prettyprint-override"><code>from tkinter import *
  from tkinter import ttk
  import tkinter as tk
  
  root = tk.Tk()
  
  class sweltres:
        
      def clearall(self):
      
              self.e.delete(0,END)
   
      def clear1(self):
              self.txt=self.e.get()[:-1]
              self.e.delete(0,END)
              self.e.insert(0,self.txt)
   
      def action(self,argi):
       
              self.e.insert(END,argi)
   
      def __init__(self,master):
         
              master.title('Calculator')
              master.geometry(&quot;100x50&quot;)
              self.e = ttk.Entry(master)
              self.e.grid(row=0,column=0,columnspan=6,pady=3)
              self.e.focus_set() 
              
      
              Button(master,text='AC',width=5,height=3,
                          fg=&quot;black&quot;, bg=&quot;blue&quot;,
              command=lambda:self.clearall()).grid(row=4, column=2)
   
              Button(master,text='C',width=5,height=3,
                  fg=&quot;red&quot;,bg=&quot;blue&quot;,
                  command=lambda:self.clear1()).grid(row=4, column=0)
   
              Button(master,text=&quot;7&quot;,width=5,height=3,
                  fg=&quot;white&quot;,bg=&quot;blue&quot;,
                  command=lambda:self.action('7')).grid(row=1, column=0)
   
              Button(master,text=&quot;8&quot;,width=5,height=3,
                  fg=&quot;white&quot;,bg=&quot;blue&quot;,
                  command=lambda:self.action(8)).grid(row=1, column=1)
   
              Button(master,text=&quot;9&quot;,width=5,height=3,
                  fg=&quot;white&quot;,bg=&quot;blue&quot;,
                  command=lambda:self.action(9)).grid(row=1, column=2)
   
              Button(master,text=&quot;4&quot;,width=5,height=3,
                  fg=&quot;white&quot;,bg=&quot;blue&quot;,
                  command=lambda:self.action(4)).grid(row=2, column=0)
   
              Button(master,text=&quot;5&quot;,width=5,height=3,
                  fg=&quot;white&quot;,bg=&quot;blue&quot;,
                  command=lambda:self.action(5)).grid(row=2, column=1)
   
              Button(master,text=&quot;6&quot;,width=5,height=3,
                  fg=&quot;white&quot;,bg=&quot;blue&quot;,
                  command=lambda:self.action(6)).grid(row=2, column=2)
   
              Button(master,text=&quot;1&quot;,width=5,height=3,
                  fg=&quot;white&quot;,bg=&quot;blue&quot;,
                  command=lambda:self.action(1)).grid(row=3, column=0)
   
              Button(master,text=&quot;2&quot;,width=5,height=3,
                  fg=&quot;white&quot;,bg=&quot;blue&quot;,
                  command=lambda:self.action(2)).grid(row=3, column=1)
   
              Button(master,text=&quot;3&quot;,width=5,height=3,
                  fg=&quot;white&quot;,bg=&quot;blue&quot;,
                  command=lambda:self.action(3)).grid(row=3, column=2)
     
              Button(master,text=&quot;0&quot;,width=5,height=3,
                  fg=&quot;white&quot;,bg=&quot;blue&quot;,
                  command=lambda:self.action(0)).grid(row=4, column=1)
                          
              Button(master, text=&quot;Exit wtf&quot;,width=23,height=3, 
                   fg=&quot;white&quot;,bg=&quot;red&quot;, command=master.destroy).grid(row=6, column=0, columnspan=3)
  
  
  sweltres(root)
  root.mainloop()
  </code></pre>