Python 3.8.9 MacOS M1 tkinter UI not opening inside of VSCode

Viewed 130

so I am trying to use Tkinter inside of VSCode on my M1 mac. When I use Tkinter through IDLE it works fine but once I try to open it inside of VSCode it the UI submenu just stalls. I'm using python 3.8.9 as my kernel but it won't seem to open even when I switch to any other versions. Tkinter is installed fine it is just some issue with how VSCode is running it but I have no idea how to fix it.

    import tkinter as tk
    window = tk.Tk()

Here I provided some screenshots of what happens

While using Idle

While using VSCode (The app just bounces up and down never opening the UI)

1 Answers

You have not started the event loop. IDLE does mainloop for you, otherwise, you need to call it by yourself.

import tkinter as tk
root = tk.Tk()
root.mainloop()

You can refer to here.

Related