question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Tkinter not working with VSCode

See original GitHub issue

Environment data

  • VS Code version: 1.44
  • Extension version (available under the Extensions sidebar): XXX
  • OS and version: MacOS 10.14.6
  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.8.2
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): XXX
  • Relevant/affected Python packages and their versions: tkinter
  • Relevant/affected Python-related VS Code extensions and their versions: XXX

Expected behaviour

Project runs and opens Tkinter window

Actual behaviour

Traceback (most recent call last):
  File "/Users/joel/Documents/code/tkinter test.py", line 1, in <module>
    import Tkinter
ModuleNotFoundError: No module named 'Tkinter'

Steps to reproduce:

[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]

  1. This is the code
from Tkinter import *

root = Tk()

w = Label(root, text="Hello, world!")
w.pack()

root.mainloop()
  1. Run it

Logs

Output for Python in the Output panel (ViewOutput, change the drop-down the upper-right of the Output panel to Python)

[Empty]


Output from Console under the Developer Tools panel (toggle Developer Tools on under Help; turn on source maps to make any tracebacks be useful by running Enable source map support for extension debugging)


Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
brettcannoncommented, Aug 4, 2020

For anyone having issues with this, chances are you are following instructions for Python 2 code while running Python 3. In Python 2 the module was named Tkinter, but in Python 3 its name was made all lowercase as tkinter to match the rest of Python’s standard library.

0reactions
giugiozzacommented, Jul 2, 2021

@brettcannon OK sure. I already opened a new issue, so i will go ahead and add that info to it.

did you get any solution here?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot start Tkinter window in Visual Studio with Python ...
Most likely the problem is that you aren't starting the event loop. Without the event loop the program will exit immediately.
Read more >
I can't run tkinter on VS code : r/vscode
Hello, I can not run tkinter on VS code version 1.36 for mac w/Python 3.7. 3 64-bit even though it works on IDLE....
Read more >
On Win 10, no graphical window when run code
Hi I am learning Python TKInter GUI. I run following code on my Desktop running windows 10. The code runs but no root...
Read more >
Debugging configurations for Python apps in Visual Studio Code
Troubleshooting · The path to the python executable is incorrect: check the path of your selected interpreter by running the Python: Select Interpreter...
Read more >
ModuleNotFoundError: No module named 'tkinter' in Python
The Python "ModuleNotFoundError: No module named 'tkinter'" occurs when tkinter is not installed in our Python environment. To solve the error, install the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found