python - TKinter tkFileDialog.askopenfilename Always behind other windows -


i want create simple tkinter file selection dialog function use other scripts , not wider gui.

my current code is:

# select single file , return full path string def select_file(data_dir):      chdir(data_dir)      root = tkinter.tk()     root.withdraw()      file_path = tkfiledialog.askopenfilename()      return file_path 

when run file dialog behind other windows. if have spyder maximised, opens behind have minimise.

there few questions related this, i've been unable of suggested code work, apologies if viewed duplicate question.

ben

just have use root.deiconify() after file_path = tkfiledialog.askopenfilename()

but it's bad idea create new tk here.


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -