remove the screen in back of the Tkinter message box
<p>I want to show a message box, but without the parent window behind it in Python. This is my code:</p>

<pre><code>import Tkinter, tkFileDialog ,tkMessageBox
from fileManagerModule import fileManager
def load():
    global myFile,flag,msg
    flag=True
    options = {}
    options["title"] = "choose a text File"
    options['initialdir'] = '~/'
    fileName = tkFileDialog.askopenfilename(**options)
    myFile = fileManager(fileName)
    myText.delete("1.0", Tkinter.END)
    try:
        line = myFile.readFromFile()
        myText.insert("1.0", line)
    except:
        msg=Tkinter.Tk()
        msg=tkMessageBox.showerror("Error","please choose file to load")
</code></pre>

<p><a href="http://i.stack.imgur.com/f4iv9.png" rel="nofollow">screenshot</a></p>

<p>You can use the <code>withdraw()</code> function to remove the <code>window</code> being displayed in the background to just show the dialog box only.</p>

<p><strong>try this:</strong></p>

<pre><code>import Tkinter, tkFileDialog ,tkMessageBox
from fileManagerModule import fileManager
def load():
    global myFile,flag,msg
    flag=True
    options = {}
    options["title"] = "choose a text File"
    options['initialdir'] = '~/'    
    fileName = tkFileDialog.askopenfilename(**options)
    myFile = fileManager(fileName)
    myText.delete("1.0", Tkinter.END)
    try:
        line = myFile.readFromFile()
        myText.insert("1.0", line)
    except:
        msg=Tkinter.Tk()

        msg.withdraw()

        msg=tkMessageBox.showerror("Error","please choose file to load")
</code></pre>

python python-2.7 tkinter