Tkinter based program freezes on my m1 mac!

https://drive.google.com/file/d/1ZDYW4KNTW5jkyF6ezkIkDnE2rsBmJR21/view?usp=sharing
This is the link to the code.

Can’t run this program on my m1 macbook air. When I tap to run, the python launcher freezes. I tried several times with different IDEs such as pycharm, standard idle and vscode. But the same problem.
However, I tried to run another tkinter program, and it worked fine. I guess the problem is only with that code.

Btw, the code works totally fine on intel macs as well as windows pcs.

If there is someone who has the same problem please contact/reply

here is the screenshot