0

I am currently using anaconda and spyder to program python script. When I try to use tkinter. It can run only once. When I try to run the script the second time. It shows the error log: ModuleNotFoundError: No module named 'Tkinter'

from tkinter import filedialog
from tkinter import *

root = Tk()
root.filename =  filedialog.askopenfilename(initialdir = "/",title = "Select file",filetypes = (("jpeg files","*.jpg"),("all files","*.*")))
print (root.filename)

The below is the error message I got from spyder console.

from Tkinter import Tk

ModuleNotFoundError: No module named 'Tkinter'

realr
  • 3,652
  • 6
  • 23
  • 34

1 Answers1

0

Import Tips: from tkinter import * import tkinter

This works in 3.6 and 3.7

ali
  • 17
  • 5