Frage

I am using Tkinter and pyinstaller (python 2.7) and I can't seem to get file dialouges working

import Tkinter
root = Tkinter.Tk()
root.withdraw()
save_dir = tkFileDialog.asksaveasfilename()

When uncompiled it works fine but when compiled to exe it just freezes the script and does not open the dialogue. I have seen this issue cured for py2exe but not pyinstaller

War es hilfreich?

Lösung

You forgot to import tkFileDialog

import Tkinter, tkFileDialog
root = Tkinter.Tk()
root.withdraw()
save_dir = tkFileDialog.asksaveasfilename()
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top