简体   繁体   中英

Python 3.8.9 MacOS M1 tkinter UI not opening inside of VSCode

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)

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 .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM