Question

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

Was it helpful?

Solution

You forgot to import tkFileDialog

import Tkinter, tkFileDialog
root = Tkinter.Tk()
root.withdraw()
save_dir = tkFileDialog.asksaveasfilename()
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top