If I understand your question correctly, you probably need to put your long db stuff into a separate thread. Calling a long system command in a Tk program will interfere with the eventloop, and make it unresponsive while system is running.
As a quick test, can you fork off the commands(instead of system), and write the results to a file? If forked, does Tk stay alive?