Tkinter not working with VSCode
See original GitHub issueEnvironment 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]
- This is the code
from Tkinter import *
root = Tk()
w = Label(root, text="Hello, world!")
w.pack()
root.mainloop()
- Run it
Logs
Output for Python
in the Output
panel (View
→Output
, 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:
- Created 3 years ago
- Comments:10 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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 astkinter
to match the rest of Python’s standard library.did you get any solution here?