You can use function sys.exc_info() to fetch the error created by my_program.py:
# save as my_file.py
# executes a file my_program.py which has an error
from Tkinter import*
error = "%s --> %s in file my_program.py"% (sys.exc_info(), sys.exc_info())
# put error msg raised by my_program.py into text field
I am always surprised by the things Python can do! Have fun with Python!