Import error: No module named tkinter [duplicate]

人盡茶涼 提交于 2019-12-25 06:48:10

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!