Skip to content

Tkinter ( tkinter ) not working in Vs code When Imported #15851

@CoderTeam1

Description

@CoderTeam1

Environment data

  • VS Code version: 1.50.1
  • Extension version (available under the Extensions sidebar): XXX
  • OS and version: Windows 10 ( As far as I know
  • Python version (& distribution if applicable, e.g. Anaconda): python 3.8.5 Anaconda
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): Conda
  • Relevant/affected Python packages and their versions: XXX
  • Relevant/affected Python-related VS Code extensions and their versions: XXX
  • Value of the python.languageServer setting: XXX

[NOTE: If you suspect that your issue is related to the Microsoft Python Language Server (python.languageServer: 'Microsoft'), please download our new language server Pylance from the VS Code marketplace to see if that fixes your issue]

Expected behaviour

It creates a gui with4 textboxes

Actual behaviour

gives 100 errors

Steps to reproduce:

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

  1. from Tkinter import *
    import Tkinter
    import tkMessageBox

top = Tkinter.Tk()
L1 = Label(top, text="My calculator",).grid(row=0,column=1)
L2 = Label(top, text="Number 1",).grid(row=1,column=0)
L3 = Label(top, text="Number 2",).grid(row=2,column=0)
L4 = Label(top, text="Operator",).grid(row=3,column=0)
L4 = Label(top, text="Answer",).grid(row=4,column=0)

  1. See Console

Logs

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

ModuleNotFoundError: No module named 'Tkinter' PS F:\abeer\abeer pendrive\CODING\code\Abeer Codes\Calculater> & F:/abeer/CODING/Anaconda/python.exe "f:/abeer/abeer pendrive/CODING/code/Abeer Codes/Calculater/script.py" Traceback (most recent call last): File "f:/abeer/abeer pendrive/CODING/code/Abeer Codes/Calculater/script.py", line 3, in import tkMessageBox ModuleNotFoundError: No module named 'tkMessageBox' PS F:\abeer\abeer pendrive\CODING\code\Abeer Codes\Calculater> & F:/abeer/CODING/Anaconda/python.exe "f:/abeer/abeer pendrive/CODING/code/Abeer Codes/Calculater/script.py" Traceback (most recent call last): File "f:/abeer/abeer pendrive/CODING/code/Abeer Codes/Calculater/script.py", line 1, in from Tkinter import * ModuleNotFoundError: No module named 'Tkinter' PS F:\abeer\abeer pendrive\CODING\code\Abeer Codes\Calculater>

Why is this not working?

Metadata

Metadata

Assignees

Labels

area-debuggingbugIssue identified by VS Code Team member as probable buginfo-neededIssue requires more information from poster

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions