def retrieve_and_update_text(): global CURR_D num_d = e1.get().strip() ver_d = e2.get().strip() print num_d, ver_d CURR_D = (CURR_D + 1) % 3 if CURR_D == 0: root.quit() v1.set(NUM_D[CURR_D] + 1) v2.set(VER_D[CURR_D] + 2) root.withdraw() root.update_idletasks() root.deiconify()