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'

calestini
  • 3,354
  • 6
  • 20
  • 31
  • 1
    `from Tkinter import Tk` will not work in python 3 (your tag) - you must use `from tkinter import Tk` (with a small **t**) – Reblochon Masque Aug 23 '19 at 17:22
  • Possible duplicate of [Difference between tkinter and Tkinter](https://stackoverflow.com/questions/17843596/difference-between-tkinter-and-tkinter) – tgikal Aug 23 '19 at 17:45

1 Answers1

0

Import Tips: from tkinter import * import tkinter

This works in 3.6 and 3.7

GRADOV
  • 1
  • 2