How do I minimize my Tkinter window whilst I run a batch file?
<p>I have a Tkinter window with a button. This button, on click, runs a batch file which in turn runs a test suite. This is working fine so far. But I want the Tkinter window to minimize itself when I click this button and restore itself when the batch file execution is completed. I don't know how to handle this event. Help.</p>

<p>Script:</p>

<pre><code>import Tkinter
import subprocess

top=Tkinter.Tk()

def callBatchFile():
    filepath=r"C:\TestFolder\ChangeManagementBatchFile.bat"
    p=subprocess.Popen(filepath,shell=True,stdout=subprocess.PIPE)
    stdout,stderr=p.communicate()
    print p.returncode

button=Tkinter.Button(top,text="Execute",command=callBatchFile)

button.pack()
top.mainloop()
</code></pre>

<pre><code>top.wm_state('iconic')
</code></pre>

<p>should minimize your win</p>

python button tkinter onclick minimize