问题
I'm attempting to build graphics for a calculator I made, but I'm getting an error saying that there's no module tkinter. How do I fix my code so that it correctly imports tkinter?
import sys
from tkinter import*
root = Tk()
frame = Frame(root)
frame.pack()
root.title('Calculator')
root.mainloop()
回答1:
Check what python version you have
If you have python 3x:
from tkinter import *
If you have python 2x
from Tkinter import *
If both of those do not work, reinstall tkinter.
Click here to install tkinter
来源:https://stackoverflow.com/questions/36343417/import-error-no-module-named-tkinter