Ported code to Tkinter from EasyGUI