Tkinter import with PyCharm
from tkinter import*
works just fine. You just have to go to the next line and type something along the lines of
tk = Tk()
or any tkinter code and it will recognize it and work just fine.
from tkinter import*tk = Tk()btn = Button(tk, text="Click Me")btn.pack()tk.mainloop()
Does that code above work?
Hope this helps
At my case, the file that I was writing had the name "tkinter.py", when I imported the module "tkinter" what PyCharm did was import the file that I was writing, of course the message error: "Cannot find reference Tk in imported module tkinter" appeared. Its a dumb error, but check that you file not called same as module. ;)
EDIT:If you use "from tkinter import * " you must run it like this:
from tkinter import *root = Tk()root.mainloop()
- Note the uppercase "T" in "Tk".
If you use "import tkinter as tk" you must run it like this:
import tkinter as tkroot = tk.Tk()root.mainloop()
- Note the "tk" module (lowercase) before "Tk" (uppercase).