Python 3의 tkFileDialog 모듈은 어디에 있습니까? 문제는 Choosing a file in Python with simple Dialog 참조 사용 모듈 :Python3에서 파일 선택
from Tkinter import Tk
from tkFileDialog import askopenfilename
하지만를 사용하여 파이썬 3 (Tkinter를 Tkinter는을 변경 한 후) 도착를 :
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
파이썬 2.7.2 문서 (docs.python.org)
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.
을하지만 (일에서조차 매핑을 새로운 이름 일 것입니다 무슨 힌트를 제공하지 않으며, tkFileDialog 검색과 3.2.2 문서의 askopenfilename 전혀 아무 것도 반환하지 않습니다 말합니다 : 전자 새로운 서브 모듈 이름으로 이전 이름)
잭하지 않는 명백한 시도 :.
from tkinter import askopenfilename, asksaveasfilename
ImportError: cannot import name askopenfilename
어떻게 파이썬 3 askopenfilename()에 해당 부르지을?
'filedialog'는'Tkinter를 가져 오기 *에서'를 통해 사용할 수 없습니다. 당신은'from tkinter.filedialog import askopenfilename' 같은 것을해야합니다. – Shule
방금 root.withdraw() 호출을 추가하여 성가신 창을 제거했습니다. Python 3.4에서 제 코드가 정상적으로 작동했습니다. – user1741137