You can run it on a terminal, but when you run it on a VScode, you get an error when you browse members.
python-mtkinter
displays a window (version was 8.6)Be able to execute correctly on the terminal with the following code
import tkinter
root=tkinter.Tk()
root.mainloop()
The following error occurs when executing the same code in VScode
$C:/Users/kento-hayakawa/AppData/Local/Programs/Python/Python37-32/python.exe:/Git/cellautomata/cellautomata/tkinter.py
Traceback (most recent call last):
File "cellautomata/tkinter.py", line 4, in <module>
import tkinter
File "C:\Git\cellautomata\cellautomata\tkinter.py", line 6, in <module>
root=tkinter.Tk()
AttributeError: module 'tkinter' has no attribute 'Tk'
Successful execution of the following code on the terminal
import tkinter
root=tkinter.Tk()
root.mainloop()
Running the same code in VScode results in the following error
$C:/Users/kento-hayakawa/AppData/Local/Programs/Python/Python37-32/python.exe:/Git/cellautomata/cellautomata/tkinter.py
Traceback (most recent call last):
File "cellautomata/tkinter.py", line 4, in <module>
import tkinter
File "C:\Git\cellautomata\cellautomata\tkinter.py", line 6, in <module>
root=tkinter.Tk()
AttributeError: module 'tkinter' has no attribute 'Tk'
Python 3.7.2
$which python
/c/Users/kento-hayakawa/AppData/Local/Programs/Python/Python 37-32/python
Python 3.7.2
$which python
/c/Users/kento-hayakawa/AppData/Local/Programs/Python/Python 37-32/python
I looked for some similar questions, but I couldn't solve them...
Sorry for the inconvenience, but I would appreciate it if you could tell me how to solve it.
Thank you for your cooperation.
Isn't the file name you are typing and editing tkinter.py?
Then let's try a different name.
This post was edited based on @kunif's Comment and posted as Community Wiki.This post was edited based on @kunif's Comment and posted as Community Wiki.
© 2024 OneMinuteCode. All rights reserved.