I’m on Linux Ubuntu 22.10.
So I installed Tkinter using this command:
python3 -m pip install tk
and the output was fine:
Defaulting to user installation because normal site-packages is not writeable
Collecting tk
Using cached tk-0.1.0-py3-none-any.whl.metadata (693 bytes)
Using cached tk-0.1.0-py3-none-any.whl (3.9 kB)
Installing collected packages: tk
Successfully installed tk-0.1.0
so I tried to use the module; I wrote a basic file to display a window:
import tk
window = tk.Tk()
window.mainloop()
and then it threw me this error: AttributeError: module 'tk' has no attribute 'Tk'
.
Okay, I’ll just check the source file. I went to `Home/.local/lib/Python3.10/site-packages/tk/
And there are no files other than __init__.py
, which is empty.
Wait, how do I use the module then? I’m confused.
Random notice: question is subject to change (a lot), this is written by a noob with 0 programming experience.
Dw8ke is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
15