Use message to alert an Exception : Exception Dialog « GUI Tk « Python






Use message to alert an Exception

Use message to alert an Exception
from Tkinter import *
import tkMessageBox
       
def a():       
    filename = "a.txt"
    try:
        fp = open(filename)
    except:
        tkMessageBox.showwarning(
            "Open file",
            "Cannot open this file\n(%s)" % filename
        )
        return
a()

           
       








Related examples in the same category