How to write commands to terminal using tkinter?
<p>I wanted to do something like , if i type something in textbox that command would get executed completely 
like this <a href="https://i.stack.imgur.com/9Sb3N.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/9Sb3N.png" alt="enter image description here"></a></p>

<p>ie the ~Desktop should be displayed to write next command.</p>

<p>but with my code im getting this also there is an error</p>

<p><a href="https://i.stack.imgur.com/fLGFo.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fLGFo.png" alt="enter image description here"></a></p>

<p>as you can see ls command gets executed half in second case 
my code is </p>

<pre><code>#!/usr/bin/python
import Tkinter
import subprocess

import tkMessageBox
from Tkinter import *
root = Tk()
class HackBar:

  def __init__(self,master):

      frame=Frame(master,width = 600,height = 250)
      #frame.pack()

      def printconsole(event):
          print("hello dere ")
      def retrieve_input(event):
          input = self.Text.get("1.0",'end-1c')
          #print(input)
          #subprocess.call(input,shell=TRUE)
          subprocess.Popen(input)
          root.quit()
          #root = Tk()
          #print p.communicate()

      self.button1 = Button(root,text = "Execute")
      self.button1.bind("&lt;Button-1&gt;",retrieve_input);
      self.button1.grid(row = 0,sticky = E)

      self.button2 = Button(root,text = "  Quit   ")
      self.button2.bind("&lt;Button-1&gt;",printconsole);
      self.button2.grid(row = 1,sticky = E)

      self.Text = Text(root,height =4)
      self.Text.grid(row = 0,column = 1,rowspan=2)

menu = Menu(root)
def AboutDialog():
    tkMessageBox.showinfo('About','For any issues or suggestion contact rushic24@gmail.com ')
root.config(menu = menu)
submenu1 = Menu(menu)
menu.add_cascade(label="Help",menu=submenu1)
submenu1.add_command(label = "About",command = AboutDialog)

b = HackBar(root)
root.mainloop()
</code></pre>

<p>i think i need to use the root.quit() and would again need to start root ,
but it is giving the above error.
Any alternate method would also work.</p>