Tkinter ( tkinter ) not working in Vs code When Imported #15864
Replies: 4 comments
-
please tell why this happened |
Beta Was this translation helpful? Give feedback.
-
Hi @CoderTeam1, thank you for reaching out. Does your code work when you run it outside of VS Code? Also, how did you set up your conda environment? |
Beta Was this translation helpful? Give feedback.
-
sorry couldnt reply earlier I am in india and also I didnt think of it being working outside vs code I will try and let you know and I use the base environment for every project ( first project in python ) I read articles yesterday and found out i was using code of python 2 so i changed the code to python 3 but still it is not working |
Beta Was this translation helpful? Give feedback.
-
If it's not working outside of VS Code then there's a problem in your code, not with the extension. I will convert this issue to a discussion, so that others can chime in, and hopefully help you. |
Beta Was this translation helpful? Give feedback.
-
Environment data
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]
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)
Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)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>
Beta Was this translation helpful? Give feedback.
All reactions