Lzypenguin
Lzypenguin

Reputation: 955

Visual Studio Code will not load tkinter package

I have been using VS Code to learn python. Everything has always worked great until i started trying to use tkinter. For some reason VS Code does not recognize anything from tkinter. I am trying to run this simple code:

from tkinter import * 
Tk()

And i get this error:

Exception has occurred: NameError
name 'Tk' is not defined

But when i launch IDLE3 and run that same code, it works just fine and loads the blank window. I've googled and cannot figure out what the problem is. Can someone please help me figure this out.

Thanks

Upvotes: 1

Views: 11820

Answers (1)

Danny Pinheiro
Danny Pinheiro

Reputation: 56

I also had the same issue. The problem was that the file I was trying to run was saved as tkinter.py Renamed the file to tkinter_tutorial and it worked fine. Also, you can check this link https://github.com/Microsoft/PTVS/issues/941

Upvotes: 4

Related Questions