Using time.sleep in gui code or anything that takes some time to run will block the event loop and freeze the updating of the gui widgets.
To not lock the gui code that would freeze the gui would have to be put into a separate thread.
To not lock the gui code that would freeze the gui would have to be put into a separate thread.