title: How could I connect a program with interface in python
body: <p>I want to use tkinter to set a interface for my another program, but I do not know what is my next step.</p>
  
  <p>I do not know how to connect each other.</p>
  
  <p>I do not have that concept.</p>
  
  <p>This is the code of trying to be a interface:</p>
  
  <pre><code>#!/usr/bin/env python -O
  import subprocess
  from tkinter import *
  subprocess.call('/Users/Tsu-
  AngChou/MasterProject/Practice/try_test/TEST5.py')
  
  root = Tk(className ="Documents retriever")
  svalue = StringVar() # defines the widget state as string
  w = Entry(root,textvariable=svalue) # adds a textarea widget
  w.pack()
  def act():
      print ("you entered")
      print ('%s' % svalue.get())
  foo = Button(root,text="Retrieve", command=act)
  foo.pack()
  root.mainloop()
  </code></pre>
  
  <p>This is the code of my python script:</p>
  
  <pre><code>#!/usr/bin/env python
  import string
  import os
  from bs4 import BeautifulSoup as bs
  from os import listdir
  from os.path import isfile, join
  
  
  mypath = "/Users/Tsu-AngChou/MasterProject/Practice/try_test/"
  files = listdir(mypath)
  storage = {}
  translator = str.maketrans("","",string.punctuation)
  for f in files:
    fullpath = join(mypath, f)
    if f == '.DS_Store':
              os.remove(f)
    elif isfile(fullpath):
  
      print(f)
      for html_cont in range(1):
          response = open(f,'r',encoding='utf-8')
          html_cont = response.read()
          soup = bs(html_cont, 'html.parser')
          regular_string = soup.get_text()
          new_string = regular_string.translate(translator).split()
          new_list = [item[:14] for item in new_string]
          a = dict.fromkeys(new_list, f)
          b = a
          storage.update(a)
          print(a)
          storage.append(new_list)
  
          wordfreq = []
          for w in new_list:
              wordfreq.append(new_list.count(w))
          print("Frequency:\n" ,list(zip(b,wordfreq)))
  </code></pre>
  
  <p>I want to use the value(a) and value(list(zip(b,wordfreq))
  How could I give the Button value?</p>