¿Dónde está el módulo tkFileDialog en Python 3? La cuestión Choosing a file in Python with simple Dialog referencias del módulo usando:Elegir un archivo en Python3
from Tkinter import Tk
from tkFileDialog import askopenfilename
pero usando que (después de cambiar a Tkinter Tkinter) en Python 3 obtiene:
Traceback (most recent call last):
File "C:\Documents and Settings\me\My Documents\file.pyw", line 5, in <module>
import tkFileDialog
ImportError: No module named tkFileDialog
el doc Python 2.7.2 (docs.python.org) dice:
tkFileDialog
Common dialogs to allow the user to specify a file to open or save.
These have been renamed as well in Python 3.0; they were all made submodules of the new tkinter package.
pero no da ningún indicio de cuáles serían los nuevos nombres, y la búsqueda de tkFileDialog y askopenfilename en los documentos 3.2.2 devuelve nada en absoluto (ni siquiera un mapeo de Th e nombres antiguos a los nuevos nombres submódulo)
Tratando de lo obvio no lo hace. Jack:
from tkinter import askopenfilename, asksaveasfilename
ImportError: cannot import name askopenfilename
¿Cómo se llama el equivalente de askopenfilename() en Python 3?
'filedialog' no está disponible a través de' 'tkinter importación *. Tienes que hacer algo como 'from tkinter.filedialog import askopenfilename'. – Shule
Acabo de agregar la llamada a root.withdraw(), para eliminar la molesta ventana. Mi código funcionó bien en Python 3.4 – user1741137